symfony - Sonata admin bundle: order entity field in showMapper -


i'm searching solution in development within symfony project sonata admin bundle.

2 entities: contacts , tags (manytomany relationship)

within showaction of sonata admin (tags entity), i'm unable order contacts field. not matter if use query option within field or not. used query option in create form, there query works , items sorted in select field.

this works (create form)

    protected function configureformfields(formmapper $formmapper) {     $tagsquery = $this->modelmanager          ->getentitymanager('telregbundle:tags')         ->createquery(             'select t              telregbundle:tags t              order t.title asc'         );             $formmapper           //...              ->add('tags', 'sonata_type_model', array(                 'class' => 'telregbundle\entity\tags',                                     'property' => 'title',                 'multiple' => true,                 'query' => $tagsquery,             )) 

where same approach not work (show action):

    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()                    ; } 

anyone can help? thx!

you can set annotation

/**  * @manytomany(targetentity="tags")  * @orderby({"title" = "asc"})  */ private $tags; 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -