Symfony2 のエンティティ クエリ ビルダーに追加の選択オプションを追加することが可能です。
これが私のコードです:
$builder->add('ship_to','entity',array(
'class' => 'WICCommonBundle:CustomOptions',
'property' => 'option_value',
'query_builder' => function(EntityRepository $er) {
return $er->createQueryBuilder('co')
->where('co.account=?0')
->andWhere('co.option_field=?1')
->orderBy('co.option_value', 'ASC')
->setParameters(array(
$this->account,"ship_to",
));
},
'empty_value' => 'Select Ship To',
));
次のオプションを追加して、ドロップダウン ボックスの最後に表示されるようにする必要があります。
「新規」 => 「新規追加」
これを追加してやろうとしましたが、うまくいきませんでした:
'choices' => array(
'New' => 'Add New'
),
ご協力いただきありがとうございます!