Sonata Admin フォーム内に選択リストを提供するために、選択ベースのエンティティ フォーム タイプを使用しています。私が望むのは、子プロパティを使用して、選択リスト内の要素のコレクションを表示することです。
chocieリスト内に表示されるラベルを提供する方法、または選択リスト配列にフォーマットを与える方法を知っている人はいますか?
$formMapper->add( 'frArea', 'entity', array(
'class' => 'myVendor\myBundleBundle\View\myEntity',
//When using a child property here, choice list gets corrupted/bad formatted
//'property' => 'child.property',
'property' => 'property',
'em' => 'formacions',
'query_builder' => function( EntityRepository $er )
{
return $er->createQueryBuilder( 'qb' )
->add( 'select', 'm' )
->add( 'from', 'myVendor\myBundleBundle\View\myEntity m' );
//->leftJoin('a.idiomes', 'ai');
},
'required' => false,
'label' => ucfirst( $this->trans( 'my_label', array(), $this->translationDomain, $this->langCode ) )
) );
次の方法でプロパティ オプションを使用すると'property' => 'child.property'
、次のエラーが発生します。
Neither property "nom" nor method "getProperty()" nor method "isProperty()" exists in class "Doctrine\ORM\PersistentCollection"