Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Compiled.php
Go to the documentation of this file.
1 <?php
8 
15 
20 {
24  const MODE = 'compiled';
28  protected $mode = self::MODE;
29 
33  protected $configPreference = \Magento\Framework\ObjectManager\Factory\Compiled::class;
34 
38  private $configLoader;
39 
48  protected function createFactory($arguments, $factoryClass)
49  {
50  return new $factoryClass(
51  $this->getDiConfig(),
52  $arguments['shared_instances'],
54  );
55  }
56 
62  public function getDiConfig()
63  {
64  if (!$this->config) {
65  $this->config = new \Magento\Framework\Interception\ObjectManager\Config\Compiled(
66  $this->getConfigData()
67  );
68  }
69 
70  return $this->config;
71  }
72 
78  protected function getConfigData()
79  {
80  return $this->getObjectManagerConfigLoader()->load(Area::AREA_GLOBAL);
81  }
82 
88  public function getObjectManagerConfigLoader()
89  {
90  if ($this->configLoader) {
91  return $this->configLoader;
92  }
93 
94  $this->configLoader = new \Magento\Framework\App\ObjectManager\ConfigLoader\Compiled();
95  return $this->configLoader;
96  }
97 
101  public function configureObjectManager(ConfigInterface $diConfig, &$sharedInstances)
102  {
104 
105  $objectManager->configure(
107  ->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class)
108  ->load(Area::AREA_GLOBAL)
109  );
110  $objectManager->get(\Magento\Framework\Config\ScopeInterface::class)
111  ->setCurrentScope('global');
112  $diConfig->setInterceptionConfig(
113  $objectManager->get(\Magento\Framework\Interception\Config\Config::class)
114  );
115  $sharedInstances[\Magento\Framework\Interception\PluginList\PluginList::class] = $objectManager->create(
116  \Magento\Framework\Interception\PluginListInterface::class,
117  ['cache' => $objectManager->get(\Magento\Framework\App\Interception\Cache\CompiledConfig::class)]
118  );
120  ->get(\Magento\Framework\App\Cache\Manager::class)
121  ->setEnabled([CompiledConfig::TYPE_IDENTIFIER], true);
122  }
123 }
$objectManager
Definition: bootstrap.php:17
configureObjectManager(ConfigInterface $diConfig, &$sharedInstances)
Definition: Compiled.php:101
setInterceptionConfig(\Magento\Framework\Interception\ConfigInterface $interceptionConfig)
$arguments