Skip to content

Commit 784ad8d

Browse files
committed
fix: rebuild change branch in stable version
1 parent eeb9027 commit 784ad8d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Maker/MakeEntity.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
6363
->addArgument('name', InputArgument::OPTIONAL, sprintf('Class name of the entity to create or update (e.g. <fg=yellow>%s</>)', Str::asClassName(Str::getRandomTerm())))
6464
->addOption('regenerate', null, InputOption::VALUE_NONE, 'Instead of adding new fields, simply generate the methods (e.g. getter/setter) for existing fields')
6565
->addOption('overwrite', null, InputOption::VALUE_NONE, 'Overwrite any existing getter/setter methods')
66+
->addOption('src', null, InputOption::VALUE_OPTIONAL, 'source Entity Path', 'src/Entity/')
6667
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeEntity.txt'))
6768
;
6869

@@ -87,7 +88,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
8788
return;
8889
}
8990

90-
$entityFinder = $this->fileManager->createFinder('src/Entity/')
91+
$entityFinder = $this->fileManager->createFinder($input->getOption('src'))
9192
// remove if/when we allow entities in subdirectories
9293
->depth('<1')
9394
->name('*.php');
@@ -102,7 +103,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
102103
}
103104

104105
$argument = $command->getDefinition()->getArgument('name');
105-
$question = $this->createEntityClassQuestion($argument->getDescription());
106+
$question = $this->createEntityClassQuestion($argument->getDescription(), $input->getOption('src'));
106107
$value = $io->askQuestion($question);
107108

108109
$input->setArgument('name', $value);
@@ -452,9 +453,15 @@ private function printAvailableTypes(ConsoleStyle $io)
452453
$printSection($allTypes);
453454
}
454455

455-
private function createEntityClassQuestion(string $questionText): Question
456+
/**
457+
* @param string $questionText
458+
* @param string $src
459+
*
460+
* @return Question
461+
*/
462+
private function createEntityClassQuestion(string $questionText, string $src = 'src/Entity'): Question
456463
{
457-
$entityFinder = $this->fileManager->createFinder('src/Entity/')
464+
$entityFinder = $this->fileManager->createFinder($src)
458465
// remove if/when we allow entities in subdirectories
459466
->depth('<1')
460467
->name('*.php');

0 commit comments

Comments
 (0)