2011-06-24 12 views
0

私の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 

私は新しいモジュールを生成:

PHPのsymfonyの教義:生成モジュール を--with-ショー

:--non-冗長-テンプレートフロントエンド・ユーザー・ユーザー

と私はフォームを持っているユーザーを追加します3210

http://localhost/user/new

画像:http://img692.imageshack.us/img692/7726/znew.png

私はモジュール追加からこのフォーム入力新しいのために追加して、複数のチェックボックスのためのsfWidgetFormDoctrineChoiceを変更したいと思います。 どうすれば作れますか?

THX!

+2

この質問や、あなたの前のものは、あなたが基本的なsymfonyの知識が不足していることを示しています。 [Jobeetのチュートリアル](http://www.symfony-project.org/jobeet/1_2/)を通過します。それは多くの間違いからあなたを救い、長期的にあなたの時間を節約します。 –

答えて

1

sfWidgetFormDoctrineChoiceは、それが真の上にあるならば、チェックボックス(this example from the symfony's Jobeetを確認してください)とオプションが表示されますことを「拡大」と呼ばれるオプションがあります。あなたのUserForm.class.phpで

あなたはこのようなものを配置する必要があります(あなたの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 
    ))); 

} 
... 
+0

助けてくれてありがとう:)最初の私の質問? ;) –

関連する問題