コード例 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->container->getDoctrine()->getManager($input->getOption('em'));
     if ($em->getRepository('CmsAuthentication:Group')->findOneByName($input->getArgument('name'))) {
         throw new \Exception(sprintf('Group "%s" already exists', $input->getArgument('name')));
     }
     $group = new Group();
     $group->setName($input->getArgument('name'));
     $group->setIsSuper($input->getArgument('super'));
     $em->persist($group);
     $em->flush();
     $output->writeln('Group created!');
 }
コード例 #2
0
 /**
  * @param Group $group
  * @return string
  */
 protected function groupToDummyId(Group $group)
 {
     return $this->dummyGroupMap[$group->getName()];
 }
コード例 #3
0
 protected function createEntityGroup($data)
 {
     $group = new Group();
     $group->setName($data['name']);
     $group->setIsSuper($data['isSuper']);
     $this->em->persist($group);
     return $group;
 }