Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StaticClassesGenerator.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Console\Output;
10 use Magento\Mtf\ObjectManagerInterface;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 
17 class StaticClassesGenerator extends \Symfony\Component\Console\Command\Command
18 {
24  private $objectManager;
25 
29  public function __construct(ObjectManagerInterface $objectManager)
30  {
31  parent::__construct();
32  $this->objectManager = $objectManager;
33  }
34 
40  protected function configure()
41  {
42  parent::configure();
43  $this->setName('troubleshooting:generate-static-classes')
44  ->setDescription('Generate static classes (Blocks, Pages, Repositories etc.).');
45  }
46 
55  protected function execute(InputInterface $input, OutputInterface $output)
56  {
57  $output = $this->objectManager->create(
58  Output::class,
59  ['output' => $output]
60  );
61  $output->writeln("Generating static classes...");
62  exec('php ' . MTF_BP . DIRECTORY_SEPARATOR . 'utils' . DIRECTORY_SEPARATOR . 'generate.php', $error, $exitCode);
63  if ($exitCode) {
64  $output->outputMessages(['error' => $error]);
65  }
66  $output->writeln('Static classes generation is finished.');
67  }
68 }
__construct(ObjectManagerInterface $objectManager)
$objectManager
Definition: bootstrap.php:17
exec($command, array &$output=null, &$return_var=null)
execute(InputInterface $input, OutputInterface $output)
defined('MTF_TESTS_PATH')||define('MTF_TESTS_PATH' MTF_BP
Definition: bootstrap.php:10