我在 listForm.class.php 中的部分代码:
public function configure() {
$list_id = $this->getOption('list_id');
$endkunde_id = $this->getOption('endkunde_id');
$shopname_id = 1;
$todoWrapperForm = new sfForm();
$todoWrapperForm = new sfForm();
//$todos = Doctrine_Core::getTable('Todo')->findAll();
//$todos = Doctrine_Core::getTable('EinkaufslisteElemente')->findAll();
$todos = Doctrine_Core::getTable('EinkaufslisteElemente')
->createQuery('ee')
->where('ee.einkaufsliste_id = ?', $list_id)
->innerJoin('ee.Einkaufsliste e')
->andWhere('e.shopname_id = ?', $shopname_id)
->innerJoin('e.EinkaufslisteEndkunde ek')
->execute();
foreach ($todos as $todo) {
$todoWrapperForm->embedForm($todo->getId(), new EinkaufslisteElementeForm($todo));
}
$todoWrapperForm->embedForm('new_1', new EinkaufslisteElementeForm()); // add one blank todo to start
$this->embedForm('todos', $todoWrapperForm);
$this->list = new sfWidgetFormTextarea(array(), array('rows' => '10', 'cols' => '35'));
$this->mergePostValidator(new sfValidatorDoctrineUnique(array('model'=>'todo', 'column'=>'task'), array('required' => false))) ;
$this->widgetSchema->setNameFormat('todo_list[%s]');
}
我想从“客户”创建一个额外的字段,他的名字没有隐藏,我想创建一个输入字段,用表“列表”中的 list_id 隐藏。如何使用 embedForm 做到这一点?