0
votes

my schema.yml :

User:
  columns:
    id:
      type: integer(4)
      autoincrement: true
      primary: true
    username:
      type: string(255)
    password:
      type: string(255)
  attributes:
    export: all
    validate: true

Group:
  tableName: group_table
  columns:
    id:
      type: integer(4)
      autoincrement: true
      primary: true
    name:
      type: string(255)
  relations:
    Users:
      foreignAlias: Groups
      class: User
      refClass: GroupUser

GroupUser:
  columns:
    group_id:
      type: integer(4)
      primary: true
    user_id:
      type: integer(4)
      primary: true
  relations:
    Group:
      foreignAlias: GroupUsers
    User:
      foreignAlias: GroupUsers
additional:
  columns:
    id:
      type: integer(4)
      autoincrement: true
      primary: true
    new:
      type: string(255)
  attributes:
    export: all
    validate: true

i generated new module:

php symfony doctrine:generate-module --with-show --non-verbose-templates frontend user User

and i have form add user:

http://localhost/user/new

image: http://img692.imageshack.us/img692/7726/znew.png

i would like add for this form input new from the module additional and change the sfWidgetFormDoctrineChoice for multiple checkbox. how can i make it?

THX!

1
This question and your previous one indicate that your missing fundamental Symfony knowledge. Go through the Jobeet Tutorial. It will save you from many mistakes and save you time in the long run.Jeremy Kauffman

1 Answers

1
votes

sfWidgetFormDoctrineChoice has an option called 'expanded' that if it's on true then will display the options with checkboxes (check this example from the symfony's Jobeet).

In your UserForm.class.php you have to put something like this (check your BaseUserForm.class.php)

<!-- lib/form/doctrine/UserForm.class.php -->
...
public function configure(){

    $this->setWidget('groups_list', new sfWidgetFormDoctrineChoice(array(
              'multiple' => true, 
              'model' => 'Group', //check that on your base
              'expanded' => true, //set checkboxs
    )));

}
...