Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Cron.php
Go to the documentation of this file.
1 <?php
8 namespace Magento\Framework\App;
9 
12 
17 {
21  protected $_state;
22 
26  protected $_request;
27 
31  protected $_response;
32 
38  private $objectManager;
39 
43  private $areaList;
44 
55  public function __construct(
56  State $state,
57  Console\Request $request,
58  Console\Response $response,
59  ObjectManagerInterface $objectManager,
60  array $parameters = [],
61  \Magento\Framework\App\AreaList $areaList = null
62  ) {
63  $this->_state = $state;
64  $this->_request = $request;
65  $this->_request->setParams($parameters);
66  $this->_response = $response;
67  $this->objectManager = $objectManager;
68  $this->areaList = $areaList ? $areaList : $this->objectManager->get(\Magento\Framework\App\AreaList::class);
69  }
70 
76  public function launch()
77  {
78  $this->_state->setAreaCode(Area::AREA_CRONTAB);
79  $configLoader = $this->objectManager->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class);
80  $this->objectManager->configure($configLoader->load(Area::AREA_CRONTAB));
81 
82  $this->areaList->getArea(Area::AREA_CRONTAB)->load(Area::PART_TRANSLATE);
83 
85  $eventManager = $this->objectManager->get(\Magento\Framework\Event\ManagerInterface::class);
86  $eventManager->dispatch('default');
87  $this->_response->setCode(0);
88  return $this->_response;
89  }
90 
94  public function catchException(App\Bootstrap $bootstrap, \Exception $exception)
95  {
96  return false;
97  }
98 }
$response
Definition: 404.php:11
__construct(State $state, Console\Request $request, Console\Response $response, ObjectManagerInterface $objectManager, array $parameters=[], \Magento\Framework\App\AreaList $areaList=null)
Definition: Cron.php:55
$objectManager
Definition: bootstrap.php:17
catchException(App\Bootstrap $bootstrap, \Exception $exception)
Definition: Cron.php:94
if(defined('TESTS_MAGENTO_INSTALLATION') &&TESTS_MAGENTO_INSTALLATION==='enabled') $bootstrap
Definition: bootstrap.php:73