2011-01-26 79 views
0

我有文章管理模塊和標籤模塊 標籤僅僅是每行項目的單個標籤的symfony - embeddedForm - 多張複選框

我想要做的是嵌入所有標籤的列表(如複選框)插入我的文章模塊

我可以使用嵌入式表單嗎?

感謝

編輯:

這是我的架構:

article: 
    id:          ~ 
    title:         { type: VARCHAR, size: '255', required: true } 
    tags:         { type: VARCHAR, size: '500' } 
    created_at:        { type: TIMESTAMP, required: true } 
    updated_at:        { type: TIMESTAMP, required: true } 

tag: 
    id:          ~ 
    tag:          { type: VARCHAR, size: '500', required: true } 
    ord_id:         { type: INTEGER, required: true } 
    created_at:        ~ 
    updated_at:        ~ 

item_tag: 
    id:          ~ 
    item_id:         { type: INTEGER, required: true, foreignTable: item, foreignReference: id, onDelete: cascade } 
    tag_id:         { type: INTEGER, required: true, foreignTable: tag, foreignReference: id, onDelete: restrict } 
    created_at:        ~ 

item: 
    id:          ~ 
    article_id:        { type: INTEGER, foreignTable: article, foreignReference: id, onDelete: cascade } 

所以,當我需要顯示的標籤和將更新上表

感謝

+0

您是使用Doctrine還是Propel?我認爲你的意思是「模型」而不是「模塊」? – richsage 2011-01-26 14:38:35

+0

我正在使用Propel。那麼我有一篇文章管理模塊(文章模型)和標籤管理模塊(標籤模型)和一個項目模型。你可以在上面的模式中看到關係。我只需要根據選項將複選框顯示爲複選框。這可能嗎? – terrid25 2011-01-27 09:18:06

回答

0

如果您已經定義了文章和標籤之間的關係在你的模型中正確的,那麼生成的表單應該包含標籤選擇小部件。

搜索「sfWidgetFormChoice」的詳細信息的表格文檔中: http://www.symfony-project.org/jobeet/1_4/Doctrine/en/10

注:使用ORM學說創建的例子,但一切都應該工作方式相同與波輪爲好。