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!'); }
/** * @param Group $group * @return string */ protected function groupToDummyId(Group $group) { return $this->dummyGroupMap[$group->getName()]; }
protected function createEntityGroup($data) { $group = new Group(); $group->setName($data['name']); $group->setIsSuper($data['isSuper']); $this->em->persist($group); return $group; }