9 use Symfony\Component\Console\Application;
12 use Zend\ServiceManager\ServiceLocatorInterface;
27 private $serviceLocator;
32 private $objectManager;
44 ServiceLocatorInterface $serviceLocator,
47 $this->serviceLocator = $serviceLocator;
59 if (
null === $this->objectManager) {
62 $this->objectManager =
$factory->create($initParams);
63 if (PHP_SAPI ==
'cli') {
64 $this->createCliCommands();
67 return $this->objectManager;
75 private function createCliCommands()
78 $commandList = $this->objectManager->create(CommandListInterface::class);
79 foreach ($commandList->getCommands() as $command) {
80 $command->setApplication(
81 $this->serviceLocator->get(Application::class)
93 $this->objectManager =
null;
115 return $this->bootstrap->createObjectManagerFactory(
__construct(ServiceLocatorInterface $serviceLocator, Bootstrap $bootstrap)
getObjectManagerFactory($initParams=[])
if(defined('TESTS_MAGENTO_INSTALLATION') &&TESTS_MAGENTO_INSTALLATION==='enabled') $bootstrap
setObjectManager(ObjectManagerInterface $objectManager)