I have a Post entity which can have multiple comments. I want to show a link to the comments in the Post list view as a new column.
For that I have defined a route which will be used inside the Post list generator.
admin_post_comments:
prefix: /admin
path: /post/{post_id}/comment/list
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('title', null, array('label' => 'Title'))
->add('comments', 'url',
array('label' => 'Comments',
'route' => array(
'name' => 'admin_post_comments',
'parameters' => array('post_id' => 'post.id')
)));
}
But how do I get the actual "post id" for each row, in order to generate the correct ur? Right now the URL will be "/post/post.id/comment/list" but needs to be "/post/1/comment/list"
When I choose "comments" as the column field type, then the field stays empty. How can I get it to write "view comments"?
Thanks,
Hendrik