From 784ad8da69a8e6ed0d1c2c42f29d5f75a6b1ea3f Mon Sep 17 00:00:00 2001 From: Roberto Moreno P Date: Mon, 14 May 2018 12:04:36 -0400 Subject: [PATCH] fix: rebuild change branch in stable version --- src/Maker/MakeEntity.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Maker/MakeEntity.php b/src/Maker/MakeEntity.php index 5a792b2d4..643ab4b54 100644 --- a/src/Maker/MakeEntity.php +++ b/src/Maker/MakeEntity.php @@ -63,6 +63,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf ->addArgument('name', InputArgument::OPTIONAL, sprintf('Class name of the entity to create or update (e.g. %s)', Str::asClassName(Str::getRandomTerm()))) ->addOption('regenerate', null, InputOption::VALUE_NONE, 'Instead of adding new fields, simply generate the methods (e.g. getter/setter) for existing fields') ->addOption('overwrite', null, InputOption::VALUE_NONE, 'Overwrite any existing getter/setter methods') + ->addOption('src', null, InputOption::VALUE_OPTIONAL, 'source Entity Path', 'src/Entity/') ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeEntity.txt')) ; @@ -87,7 +88,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma return; } - $entityFinder = $this->fileManager->createFinder('src/Entity/') + $entityFinder = $this->fileManager->createFinder($input->getOption('src')) // remove if/when we allow entities in subdirectories ->depth('<1') ->name('*.php'); @@ -102,7 +103,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma } $argument = $command->getDefinition()->getArgument('name'); - $question = $this->createEntityClassQuestion($argument->getDescription()); + $question = $this->createEntityClassQuestion($argument->getDescription(), $input->getOption('src')); $value = $io->askQuestion($question); $input->setArgument('name', $value); @@ -452,9 +453,15 @@ private function printAvailableTypes(ConsoleStyle $io) $printSection($allTypes); } - private function createEntityClassQuestion(string $questionText): Question + /** + * @param string $questionText + * @param string $src + * + * @return Question + */ + private function createEntityClassQuestion(string $questionText, string $src = 'src/Entity'): Question { - $entityFinder = $this->fileManager->createFinder('src/Entity/') + $entityFinder = $this->fileManager->createFinder($src) // remove if/when we allow entities in subdirectories ->depth('<1') ->name('*.php');