0
私はSonata管理バンドルを持つSymfonyプロジェクト内の開発でこのソリューションを探しています。Sonata管理バンドル:showMapperの注文エンティティフィールド
2エンティティ:連絡先とタグ(多対多の関係)
ソナタ管理(タグエンティティ)のshowactionの中には、私が連絡先フィールドを注文することができませんでしだ。フィールド内でクエリオプションを使用するかどうかは関係ありません。私は作成フォームでクエリオプションを使用しました。そこではクエリがうまく機能し、項目は選択フィールドでソートされます。
これは、同じアプローチが動作しません
protected function configureFormFields(FormMapper $formMapper)
{
$TagsQuery = $this->modelManager
->getEntityManager('TelRegBundle:Tags')
->createQuery(
'SELECT t
FROM TelRegBundle:Tags t
ORDER BY t.title ASC'
);
$formMapper
//...
->add('tags', 'sonata_type_model', array(
'class' => 'TelRegBundle\Entity\Tags',
'property' => 'title',
'multiple' => true,
'query' => $TagsQuery,
))
(showアクション)(フォームを作成する)動作します。助けることができる
protected function configureShowFields(ShowMapper $showMapper)
{
$showMapper
->with('Tags data')
->add('title')
->end()
->with('Contacts')
->add('contacts', 'entity', array(
'class' => 'TelRegBundle:Contacts',
'associated_property' => 'title',
'query' => ... //Querybuilder not working.
))
->end()
;
}
誰もが?どうも!
annotationはありがとうござい設定することができます。私はあなたの提案を試みます –
イワン、これは解決策でした。ライブはしばしばとても簡単です!多くのthx! –