Skip to content

Commit

Permalink
merged branch arnogeurts/PR-2688 (PR symfony#2879)
Browse files Browse the repository at this point in the history
Commits
-------

7ac43fc 2879: missing space between catch and the brace
0900ecc symfony#2688: Entities are generated in wrong folder (doctrine:generate:entities Namespace)

Discussion
----------

[Console] [Doctrine] Fixed: Entities are generated in wrong folder (doctrine:generate:entities Namespace)

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: no
Fixes the following tickets: 2688
Todo: -

See PR 2746 for the description of the bug.

Bug-description:
Running the command "$php app/console doctrine:generate:entities [bundle name]" from the commandline throws an exception when the entities do not exist yet. Because metadata of the entity class could not be retrieved.

Bugfix:-description:
Fall back to bundle metadata when no entity metadata could not be retrieved.
  • Loading branch information
fabpot committed Dec 14, 2011
2 parents 9641c55 + 7ac43fc commit dbce8d9
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -113,7 +113,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf(' > backing up <comment>%s.php</comment> to <comment>%s.php~</comment>', $basename, $basename)); $output->writeln(sprintf(' > backing up <comment>%s.php</comment> to <comment>%s.php~</comment>', $basename, $basename));
} }
// Getting the metadata for the entity class once more to get the correct path if the namespace has multiple occurrences // Getting the metadata for the entity class once more to get the correct path if the namespace has multiple occurrences
$entityMetadata = $manager->getClassMetadata($m->getName(), $input->getOption('path')); try {
$entityMetadata = $manager->getClassMetadata($m->getName(), $input->getOption('path'));
} catch (\RuntimeException $e) {
// fall back to the bundle metadata when no entity class could be found
$entityMetadata = $metadata;
}


$output->writeln(sprintf(' > generating <comment>%s</comment>', $m->name)); $output->writeln(sprintf(' > generating <comment>%s</comment>', $m->name));
$generator->generate(array($m), $entityMetadata->getPath()); $generator->generate(array($m), $entityMetadata->getPath());
Expand Down

0 comments on commit dbce8d9

Please sign in to comment.