如何从选择选项中获取所选项目的值在symfony?(来自以下文章)
我的表单中包含该配置:
$this->widgetSchema['category_id'] = new sfWidgetFormDoctrineChoice(array(
'model' => 'Category',
'method' => 'getLibelleCat',
'add_empty' => 'select category'
));
$this->widgetSchema['article_id'] = new sfWidgetFormDoctrineDependentSelect (array(
'model' => 'Article',
'method' => 'getLibelle',
'depends' => 'Category',
'add_empty' => 'select article'
));
由于
答案 0 :(得分:1)
$this->getValue('category_id');