Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DbDataUpgradeCommand.php
Go to the documentation of this file.
1 <?php
8 
12 use Symfony\Component\Console\Input\InputInterface;
13 use Symfony\Component\Console\Output\OutputInterface;
14 
19 {
25  private $installFactory;
26 
32  private $deploymentConfig;
33 
40  public function __construct(InstallerFactory $installFactory, DeploymentConfig $deploymentConfig)
41  {
42  $this->installFactory = $installFactory;
43  $this->deploymentConfig = $deploymentConfig;
44  parent::__construct();
45  }
46 
52  protected function configure()
53  {
54  $this->setName('setup:db-data:upgrade')->setDescription('Installs and upgrades data in the DB');
55  parent::configure();
56  }
57 
61  protected function execute(InputInterface $input, OutputInterface $output)
62  {
63  if (!$this->deploymentConfig->isAvailable()) {
64  $output->writeln("<info>No information is available: the Magento application is not installed.</info>");
65  // we must have an exit code higher than zero to indicate something was wrong
66  return \Magento\Framework\Console\Cli::RETURN_FAILURE;
67  }
68  $installer = $this->installFactory->create(new ConsoleLogger($output));
69  $installer->installDataFixtures();
70  return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
71  }
72 }
$deploymentConfig
__construct(InstallerFactory $installFactory, DeploymentConfig $deploymentConfig)
execute(InputInterface $input, OutputInterface $output)