/** * @param Schema $schema */ public function up(Schema $schema) { /** * @var EntityManager $em */ $em = $this->container->get('doctrine')->getManager(); $role = new Role(); $role->setRole('ROLE_SUBCONTRACTOR_MANAGER')->setDescription('Subcontractor manager'); $em->persist($role); $em->flush(); }
/** * @param Schema $schema */ public function up(Schema $schema) { /** * @var EntityManager $em */ $em = $this->container->get('doctrine')->getManager(); $role = new Role(); $role->setRole('ROLE_SPORTMASTER_USER')->setDescription('Sportmaster user'); $em->persist($role); // $parent = $em->getRepository('CoreBundle:Menu')->findOneBy(['title' => 'Sportmaster']); $type = $em->getRepository('CoreBundle:MenuType')->findOneBy(['name' => 'sidebar']); $bundle = $em->getRepository('CoreBundle:Bundle')->findOneBy(['name' => 'sportmaster']); $item1 = new Menu(); $item1->setMenuTypeId($type)->setBundleId($bundle)->setTitle('Invoicing wizard')->setUrl('sportmaster_invoice_number')->setCss('fa fa-list')->setStatus(1)->setWeight(5); $em->persist($item1); $em->flush(); $em->getConnection()->insert('menu_role', ['menu_id' => $item1->getId(), 'role_id' => self::ROLE_ADMIN]); $em->getConnection()->insert('menu_role', ['menu_id' => $item1->getId(), 'role_id' => $role->getId()]); }