Is there any way to show total count of collection on list view? Imagine that there is a user that can have many links. How can I show total links count on list view?
with Sonata 3.** in somwhere in Admin***.php script for listing all fields:
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
//...
->addIdentifier('getCommentsCount', IntegerType::class, [ 'label' => '#Comments'])
;
}
Where in Entity i written something like this:
public function getCommentsCount()
{
return $this->comments->count();
}
that works for me )