I'd like to provide a direct link to related entities of my current entity-listing.
I've tried to use addIdentifier
for the related entities column but it redirects me to my current entity.
I found nothing in the doc explaining how to achieve this.
Here is an example of what I'm doing:
I'm currently listing my "data profile" entities. They have related entities such as "Entrainement", "Niveau", or "Programme". I would like to be redirected to the "Programme" list if I click on "Se defouler", and similarly for each of the columns which display related entities.
Here is my configureListFields
implementation from my current admin class:
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier( 'type.titre' , null, array ( 'label' => 'Type') )
->add('valeur', null, array ( 'label' => 'Valeur' ) )
->add('bioprofile.titre', null, array ( 'label' => 'Bio Profile' ) )
->add( 'exercicesData.entrainement.niveau.titre', null, array( 'label' => 'Niveau' , 'route' => array( 'name' => 'edit') ) )
->add( 'exercicesData.entrainement.titre' , many_to_one, array ( 'label' => 'Entrainement' ) )
->add( 'exercicesData.entrainement.niveau.programme.titre' , null , array ( 'label' => 'Programme' ) )
->add('_action', 'actions', array(
'actions' => array(
'show' => array(),
'edit' => array(),
'delete' => array(),
)
))
;
}
I tried different ways:
- one with the option "route" which contains an array where the name of the action of the related entity redirects ( according to the official doc )
- another one with the "many_to_one" list type , which, according the official doc, redirects to the aimed entity.
Neither of them works.
PS: In the screenshot, there are some links on "Niveau 2", "Seance 1" and "se defouler". They were actually displayed using addIdentifier
.