| @@ 49-66 (lines=18) @@ | ||
| 46 | /** |
|
| 47 | * @see Command |
|
| 48 | */ |
|
| 49 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 50 | { |
|
| 51 | $entity = Validators::validateEntityName($input->getArgument('entity')); |
|
| 52 | list($bundle, $entity) = $this->parseShortcutNotation($entity); |
|
| 53 | ||
| 54 | $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity; |
|
| 55 | $metadata = $this->getEntityMetadata($entityClass); |
|
| 56 | $bundle = $this->getApplication()->getKernel()->getBundle($bundle); |
|
| 57 | $generator = $this->getGenerator($bundle); |
|
| 58 | ||
| 59 | $generator->generate($bundle, $entity, $metadata[0]); |
|
| 60 | ||
| 61 | $output->writeln(sprintf( |
|
| 62 | 'The new %s.php class file has been created under %s.', |
|
| 63 | $generator->getClassName(), |
|
| 64 | $generator->getClassPath() |
|
| 65 | )); |
|
| 66 | } |
|
| 67 | ||
| 68 | protected function createGenerator() |
|
| 69 | { |
|
| @@ 57-74 (lines=18) @@ | ||
| 54 | /** |
|
| 55 | * @see Command |
|
| 56 | */ |
|
| 57 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 58 | { |
|
| 59 | $entity = Validators::validateEntityName($input->getArgument('entity')); |
|
| 60 | list($bundle, $entity) = $this->parseShortcutNotation($entity); |
|
| 61 | ||
| 62 | $forceOverwrite = $input->getOption('overwrite'); |
|
| 63 | ||
| 64 | $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity; |
|
| 65 | $metadata = $this->getEntityMetadata($entityClass); |
|
| 66 | $bundle = $this->getApplication()->getKernel()->getBundle($bundle); |
|
| 67 | $generator = $this->getGenerator($bundle); |
|
| 68 | ||
| 69 | $generator->generate($bundle, $entity, $metadata[0], 'yml', $forceOverwrite); |
|
| 70 | ||
| 71 | $output->writeln( |
|
| 72 | 'The new Repository pattern implementation has been created under Model and Repository folders.' |
|
| 73 | ); |
|
| 74 | } |
|
| 75 | ||
| 76 | protected function createGenerator() |
|
| 77 | { |
|