Преглед на файлове

[DoctrineBundle] fixed doctrine:generate:entity command when the entity to generate has sub-namespaces

Fabien Potencier преди 14 години
родител
ревизия
3854d34c14
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. 2 3
      src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php

+ 2 - 3
src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php

@@ -59,7 +59,7 @@ EOT
     {
         $bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
 
-        $entity = $input->getArgument('entity');
+        $entity = str_replace('/', '\\', $input->getArgument('entity'));
         $fullEntityClassName = $bundle->getNamespace().'\\Entity\\'.$entity;
         $mappingType = $input->getOption('mapping-type');
 
@@ -92,7 +92,7 @@ EOT
         $cme = new ClassMetadataExporter();
         $exporter = $cme->getExporter($mappingType);
 
-        $entityPath = $bundle->getPath().'/Entity/'.$entity.'.php';
+        $entityPath = $bundle->getPath().'/Entity/'.str_replace('\\', '/', $entity).'.php';
         if (file_exists($entityPath)) {
             throw new \RuntimeException(sprintf("Entity %s already exists.", $class->name));
         }
@@ -130,6 +130,5 @@ EOT
             }
             file_put_contents($mappingPath, $mappingCode);
         }
-
     }
 }