X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FEntityBundleCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FEntityBundleCommand.php;h=e70ba956becb89492e8f368b12920549e320515d;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=b12ef276e11c3a356692e61ee5b795c03d889725;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/drupal/console/src/Command/Generate/EntityBundleCommand.php b/vendor/drupal/console/src/Command/Generate/EntityBundleCommand.php index b12ef276e..e70ba956b 100644 --- a/vendor/drupal/console/src/Command/Generate/EntityBundleCommand.php +++ b/vendor/drupal/console/src/Command/Generate/EntityBundleCommand.php @@ -7,22 +7,19 @@ namespace Drupal\Console\Command\Generate; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ServicesTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Generator\EntityBundleGenerator; -use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; class EntityBundleCommand extends Command { - use CommandTrait; use ModuleTrait; use ServicesTrait; use ConfirmationTrait; @@ -67,7 +64,12 @@ class EntityBundleCommand extends Command ->setName('generate:entity:bundle') ->setDescription($this->trans('commands.generate.entity.bundle.description')) ->setHelp($this->trans('commands.generate.entity.bundle.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) ->addOption( 'bundle-name', null, @@ -79,7 +81,8 @@ class EntityBundleCommand extends Command null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.entity.bundle.options.bundle-title') - ); + ) + ->setAliases(['geb']); } /** @@ -87,10 +90,8 @@ class EntityBundleCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmOperation + if (!$this->confirmOperation()) { return 1; } @@ -98,10 +99,13 @@ class EntityBundleCommand extends Command $bundleName = $input->getOption('bundle-name'); $bundleTitle = $input->getOption('bundle-title'); - $generator = $this->generator; //TODO: // $generator->setLearning($learning); - $generator->generate($module, $bundleName, $bundleTitle); + $this->generator->generate([ + 'module' => $module, + 'bundle_name' => $bundleName, + 'bundle_title' => $bundleTitle, + ]); return 0; } @@ -111,20 +115,13 @@ class EntityBundleCommand extends Command */ protected function interact(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } + $this->getModuleOption(); // --bundle-name option $bundleName = $input->getOption('bundle-name'); if (!$bundleName) { - $bundleName = $io->ask( + $bundleName = $this->getIo()->ask( $this->trans('commands.generate.entity.bundle.questions.bundle-name'), 'default', function ($bundleName) { @@ -137,7 +134,7 @@ class EntityBundleCommand extends Command // --bundle-title option $bundleTitle = $input->getOption('bundle-title'); if (!$bundleTitle) { - $bundleTitle = $io->ask( + $bundleTitle = $this->getIo()->ask( $this->trans('commands.generate.entity.bundle.questions.bundle-title'), 'default', function ($bundle_title) {