public function refreshUser(ModelUser $user) { $context = $this->entityManager->getRepository('BigfootContextBundle:Context')->findOneByEntityIdEntityClass($user->getId(), 'Bigfoot\\Bundle\\UserBundle\\Entity\\User'); if ($context) { $this->session->set('bigfoot/context/allowed_contexts', $context->getContextValues()); } }