/** * @param FactoryInterface $factory * @param EntityManager $entityManager * @param TokenStorage $security */ public function __construct(FactoryInterface $factory, EntityManager $entityManager, TokenStorage $security) { $this->factory = $factory; $this->entityManager = $entityManager; $this->security = $security; $this->repository = $this->entityManager->getRepository('BigfootUserBundle:RoleMenu'); $this->menu = null; $this->children = array(); $this->user = $this->security->getToken()->getUser(); }