state = $state; $this->entityDefinitionUpdateManager = $entityDefinitionUpdateManager; $this->chainQueue = $chainQueue; parent::__construct(); } /** * {@inheritdoc} */ protected function configure() { $this ->setName('update:entities') ->setDescription($this->trans('commands.update.entities.description')); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); //$state = $this->getDrupalService('state'); $io->info($this->trans('commands.site.maintenance.messages.maintenance-on')); $io->info($this->trans('commands.update.entities.messages.start')); $this->state->set('system.maintenance_mode', true); try { $this->entityDefinitionUpdateManager->applyUpdates(); /* @var EntityStorageException $e */ } catch (EntityStorageException $e) { /* @var Error $variables */ $variables = Error::decodeException($e); $io->info($this->trans('commands.update.entities.messages.error')); $io->info($variables); } $this->state->set('system.maintenance_mode', false); $io->info($this->trans('commands.update.entities.messages.end')); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); $io->info($this->trans('commands.site.maintenance.messages.maintenance-off')); } }