public function granted(\Learning\MainBundle\Entity\User $user, $role) { return in_array($role, $user->getRoles()); }