| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 19 | protected function execute(InputInterface $input, OutputInterface $output) { |
||
| 20 | $em = $this->getContainer()->get('doctrine')->getManager(); |
||
| 21 | $array = array( |
||
| 22 | array('ROLE_USER','User'), |
||
| 23 | array('ROLE_ADMIN','Administrator'), |
||
| 24 | array('ROLE_SUPER_ADMIN','Super Administrator'), |
||
| 25 | ); |
||
| 26 | |||
| 27 | foreach($array as $row) { |
||
| 28 | $obj = new Group(); |
||
| 29 | $obj->setRole($row[0]); |
||
| 30 | $obj->setName($row[1]); |
||
| 31 | $em->persist($obj); |
||
| 32 | $output->writeln(sprintf('%s (%s), ', $obj->getRole(), $obj->getName())); |
||
| 33 | } |
||
| 34 | $em->flush(); |
||
| 35 | |||
| 36 | $output->writeln(sprintf('Created %s built-in groups/roles, ', count($array))); |
||
| 37 | } |
||
| 38 | } |