Permalink
Browse files

merged branch danielsan80/2.0 (PR #111)

Commits
-------

2f79b94 changed namespace used
766bbbc catched a not managed runtime exception in crud generation

Discussion
----------

app/console doctrine:generate:crud does not work if @AcmeMyBundle/Resources/config/routing.yml is not empty

If I run this command 2 times for the same bundle, for 2 different entities for example, it throw a RuntimeException stopping wizard. I catched it and ignored so it can complete the wizard.
  • Loading branch information...
2 parents dd37fc4 + 2f79b94 commit b1ccb78c1743f30817b0fce9bb5c6baff6ed7bf8 @fabpot fabpot committed Mar 2, 2012
Showing with 7 additions and 2 deletions.
  1. +6 −1 Command/GenerateDoctrineCrudCommand.php
  2. +1 −1 Tests/Generator/BundleGeneratorTest.php
@@ -204,7 +204,12 @@ private function updateRouting($dialog, InputInterface $input, OutputInterface $
$output->write('Importing the CRUD routes: ');
$this->getContainer()->get('filesystem')->mkdir($bundle->getPath().'/Resources/config/');
$routing = new RoutingManipulator($bundle->getPath().'/Resources/config/routing.yml');
- $ret = $auto ? $routing->addResource($bundle->getName(), $format, '/'.$prefix, 'routing/'.strtolower(str_replace('\\', '_', $entity))) : false;
+ try {
+ $ret = $auto ? $routing->addResource($bundle->getName(), $format, '/'.$prefix, 'routing/'.strtolower(str_replace('\\', '_', $entity))) : false;
+ } catch (\RuntimeException $exc) {
+ $ret = false;
+ }
+
if (!$ret) {
$help = sprintf(" <comment>resource: \"@%s/Resources/config/routing/%s.%s\"</comment>\n", $bundle->getName(), strtolower(str_replace('\\', '_', $entity)), $format);
$help .= sprintf(" <comment>prefix: /%s</comment>\n", $prefix);
@@ -12,7 +12,7 @@
namespace Sensio\Bundle\GeneratorBundle\Tests\Generator;
use Sensio\Bundle\GeneratorBundle\Generator\BundleGenerator;
-use Symfony\Component\HttpKernel\Util\Filesystem;
+use Symfony\Component\Filesystem\Filesystem;
class BundleGeneratorTest extends GeneratorTest
{

0 comments on commit b1ccb78

Please sign in to comment.