| @@ 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 | { |
|
| @@ 48-65 (lines=18) @@ | ||
| 45 | /** |
|
| 46 | * @see Command |
|
| 47 | */ |
|
| 48 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 49 | { |
|
| 50 | $entity = Validators::validateEntityName($input->getArgument('entity')); |
|
| 51 | list($bundle, $entity) = $this->parseShortcutNotation($entity); |
|
| 52 | ||
| 53 | $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle).'\\'.$entity; |
|
| 54 | $metadata = $this->getEntityMetadata($entityClass); |
|
| 55 | $bundle = $this->getApplication()->getKernel()->getBundle($bundle); |
|
| 56 | $generator = $this->getGenerator($bundle); |
|
| 57 | ||
| 58 | $generator->generate($bundle, $entity, $metadata[0]); |
|
| 59 | ||
| 60 | $output->writeln(sprintf( |
|
| 61 | 'The new %s.php class file has been created under %s.', |
|
| 62 | $generator->getClassName(), |
|
| 63 | $generator->getClassPath() |
|
| 64 | )); |
|
| 65 | } |
|
| 66 | ||
| 67 | protected function createGenerator() |
|
| 68 | { |
|