2012-11-04 47 views
1
JobeetCategory: 
    actAs: { Timestampable: ~ } 
    columns: 
    name: { type: string(255), notnull: true, unique: true } 
    test: { type: string(255), notnull: true, unique: true } 

JobeetJob: 
    actAs: { Timestampable: ~ } 
    columns: 
    category_id: { type: integer, notnull: true } 
    type:   { type: string(255) } 
    company:  { type: string(255), notnull: true } 
    relations: 
    JobeetCategory: { onDelete: CASCADE, local: category_id, foreign: id, foreignAlias: JobeetJobs } 

管理生成的值在對應JobeetJobForm我增加:Symfony的1 - 從嵌入形式

$cat = new JobeetCategory(); 
$this->embedForm('category', $cat); 

和我生成ADMIN。

現在我可以從這些窗體的所有小部件。我可以在generator.yml中更改它。有位形式

form: 
    display: 
     One: [category_id, type] 
     Two: [company, test] // test - not working 

我有錯誤部件測試不存在。我如何在生成器中使用嵌入表單?

我嘗試:

form: 
    display: 
     One: [category_id, type] 
     Two: [company, JobeetCategory[test]] 

但這也不能正常工作。

+0

什麼是'測試'在你的情況?公司名稱? – j0k

+0

這是JobetCategory –

回答

0

您不能從嵌入表單中添加一個孤獨的字段,您應該將整個嵌入表單添加到顯示鍵。

form: 
    display: 
     One: [category_id, type] 
     Two: [company, category] 
+0

中的附加字段我知道這一點,但我如何爲此現場測試添加? –

+0

測試字段位於嵌入類別表單中,因此如果顯示嵌入類別表單,則會顯示測試字段以及名稱字段。 – j0k

+0

好的,謝謝,但如何獲得只有現場測試? –