Skip to content

Commit 1003c21

Browse files
committed
Swap target entity namespace search
1 parent 7fb5a31 commit 1003c21

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Maker/MakeEntity.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,16 +468,16 @@ private function askRelationDetails(ConsoleStyle $io, string $generatedEntityCla
468468

469469
$targetEntityClass = $io->askQuestion($question);
470470

471-
if (!class_exists($targetEntityClass)) {
472-
if (!class_exists($this->getEntityNamespace().'\\'.$targetEntityClass)) {
471+
if (!class_exists($designatedTargetClass = $this->getEntityNamespace().'\\'.$targetEntityClass)) {
472+
if (!class_exists($designatedTargetClass = $targetEntityClass)) {
473473
$io->error(sprintf('Unknown class "%s"', $targetEntityClass));
474474
$targetEntityClass = null;
475475

476476
continue;
477477
}
478-
479-
$targetEntityClass = $this->getEntityNamespace().'\\'.$targetEntityClass;
480478
}
479+
480+
$targetEntityClass = $designatedTargetClass;
481481
}
482482

483483
// help the user select the type

tests/fixtures/MakeEntityExistsInRoot/tests/GeneratedEntityTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testGeneratedEntity()
2121

2222
$directory = new Directory();
2323
// check that the constructor was instantiated properly
24-
$this->assertInstanceOf(ArrayCollection::class, $directory->getChildUsers());
24+
$this->assertInstanceOf(ArrayCollection::class, $directory->getChildDirectories());
2525
// set existing field
2626
$directory->setName('root');
2727
$em->persist($directory);
@@ -34,7 +34,7 @@ public function testGeneratedEntity()
3434
// set via the inverse side
3535
$subDir2 = new Directory();
3636
$subDir2->setName('fixtures');
37-
$directory->addChildUser($subDir2);
37+
$directory->addChildDirectory($subDir2);
3838
$em->persist($subDir2);
3939

4040
$em->flush();

0 commit comments

Comments
 (0)