Skip to content

Commit 3854d34

Browse files
committed
[DoctrineBundle] fixed doctrine:generate:entity command when the entity to generate has sub-namespaces
1 parent 9844685 commit 3854d34

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5959
{
6060
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
6161

62-
$entity = $input->getArgument('entity');
62+
$entity = str_replace('/', '\\', $input->getArgument('entity'));
6363
$fullEntityClassName = $bundle->getNamespace().'\\Entity\\'.$entity;
6464
$mappingType = $input->getOption('mapping-type');
6565

@@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9292
$cme = new ClassMetadataExporter();
9393
$exporter = $cme->getExporter($mappingType);
9494

95-
$entityPath = $bundle->getPath().'/Entity/'.$entity.'.php';
95+
$entityPath = $bundle->getPath().'/Entity/'.str_replace('\\', '/', $entity).'.php';
9696
if (file_exists($entityPath)) {
9797
throw new \RuntimeException(sprintf("Entity %s already exists.", $class->name));
9898
}
@@ -130,6 +130,5 @@ protected function execute(InputInterface $input, OutputInterface $output)
130130
}
131131
file_put_contents($mappingPath, $mappingCode);
132132
}
133-
134133
}
135134
}

0 commit comments

Comments
 (0)