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')) ->setAliases(['upe']); ; } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { //$state = $this->getDrupalService('state'); $this->getIo()->info($this->trans('commands.site.maintenance.messages.maintenance-on')); $this->getIo()->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); $this->getIo()->errorLite($this->trans('commands.update.entities.messages.error')); $this->getIo()->error(strtr('%type: @message in %function (line %line of %file).', $variables)); } $this->state->set('system.maintenance_mode', false); $this->getIo()->info($this->trans('commands.update.entities.messages.end')); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); $this->getIo()->info($this->trans('commands.site.maintenance.messages.maintenance-off')); } }