private function createGroups(OutputInterface $output)
    {
        $em = $this->container->get('ekyna_user.group.manager');
        $repository = $this->container->get('ekyna_user.group.repository');

        foreach ($this->defaultGroups as $name => $options) {
            $output->write(sprintf(
                '- <comment>%s</comment> %s ',
                $name,
                str_pad('.', 44 - mb_strlen($name), '.', STR_PAD_LEFT)
            ));
            if (null !== $group = $repository->findOneBy(['name' => $name])) {
                $output->writeln('already exists.');
                continue;
            }
            /** @var \Ekyna\Bundle\UserBundle\Model\GroupInterface $group */
            $group = $repository->createNew();
            $group
                ->setDefault($options[2])
                ->setName($name)
                ->setRoles($options[0])
            ;
            $em->persist($group);
            $output->writeln('created.');
        }
        $em->flush();
    }
private function createGroups(OutputInterface $output)
    {
        $em = $this->container->get('ekyna_user.group.manager');
        $repository = $this->container->get('ekyna_user.group.repository');

        foreach ($this->defaultGroups as $name => $options) {
            $output->write(sprintf(
                '- <comment>%s</comment> %s ',
                $name,
                str_pad('.', 44 - mb_strlen($name), '.', STR_PAD_LEFT)
            ));
            if (null !== $group = $repository->findOneBy(['name' => $name])) {
                $output->writeln('already exists.');
                continue;
            }
            /** @var \Ekyna\Bundle\UserBundle\Model\GroupInterface $group */
            $group = $repository->createNew();
            $group
                ->setDefault($options[2])
                ->setName($name)
                ->setRoles($options[0])
            ;
            $em->persist($group);
            $output->writeln('created.');
        }
        $em->flush();
    }
private function createGroups ( OutputInterface $ output ) { $ em = $ this -> container -> get ( 'ekyna_user.group.manager' ) ; $ repository = $ this -> container -> get ( 'ekyna_user.group.repository' ) ; foreach ( $ this -> defaultGroups as $ name => $ options ) { $ output -> write ( sprintf ( '- <comment>%s</comment> %s ' , $ name , str_pad ( '.' , 44 - mb_strlen ( $ name ) , '.' , STR_PAD_LEFT ) ) ) ; if ( null !== $ group = $ repository -> findOneBy ( [ 'name' => $ name ] ) ) { $ output -> writeln ( 'already exists.' ) ; continue ; } /** @var \Ekyna\Bundle\UserBundle\Model\GroupInterface $group */ $ group = $ repository -> createNew ( ) ; $ group -> setDefault ( $ options [ 2 ] ) -> setName ( $ name ) -> setRoles ( $ options [ 0 ] ) ; $ em -> persist ( $ group ) ; $ output -> writeln ( 'created.' ) ; } $ em -> flush ( ) ; }
Creates default groups entities

@param OutputInterface $output
Creates default groups entities