I have in my entity:
/**
* @ORM\ManyToMany(targetEntity="Sancho\UserBundle\Entity\followers", mappedBy="followers")
*/
private $followers;
In Sonata i want to get the number of $followers[]. I create in my entity:
public function getFollow()
{
return count($this->followers);
}
In UserAdmin i have:
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('id')
->add('follow', null, array('sortable'=>true));
}
I have the number of $follow[] but i can't sort the field. When i sort i have the error:
PHP Catchable fatal error: Argument 1 passed to Sonata\\DoctrineORMAdminBundle\\Datagrid\\ProxyQuery::entityJoin() must be of the type array, null given, called in /home/sancho/work/Web/vendor/sonata-project/doctrine-orm-admin-bundle/Datagrid/ProxyQuery.php on line 140 and defined in /home/sancho/work/Web/vendor/sonata-project/doctrine-orm-admin-bundle/Datagrid/ProxyQuery.php on line 245