Skip to content

Commit ddf5d55

Browse files
committed
fix: add src option for not standard paths
1 parent 319a73d commit ddf5d55

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Maker/MakeEntity.php

Lines changed: 5 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);
@@ -453,9 +454,9 @@ private function printAvailableTypes(ConsoleStyle $io)
453454
$printSection($allTypes);
454455
}
455456

456-
private function createEntityClassQuestion(string $questionText): Question
457+
private function createEntityClassQuestion(string $questionText, string $src): Question
457458
{
458-
$entityFinder = $this->fileManager->createFinder('src/Entity/')
459+
$entityFinder = $this->fileManager->createFinder($src)
459460
// remove if/when we allow entities in subdirectories
460461
->depth('<1')
461462
->name('*.php');

0 commit comments

Comments
 (0)