So i have the following filter:
class ClientFilter extends SQLFilter
{
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
{
return $targetTableAlias.'client_id = '. $this->getParameter('client_id');
}
}
and in my controller:
$em = $this->get('doctrine.orm.default_entity_manager');
$filter = $em->getFilters()->enable('client_filter');
var_dump($em->getFilters()->isEnabled('client_filter'));
it prints out bool(true)
which means it is enabled, but when i look into the doctrine sql commands from symfony profiler i can't see the client_id in the WHERE
statment
And i can't set it globally because i only need it after login. So the question will be, how can i check if the filter is working or not? and the other side question will be if i set it globally is there a way to only make it work after login because the user table doesnt have a client_id and it gives an error since the client id is only added after login depends on which user will login.
p.s i am adding the client_id to the session after login!