本文整理汇总了PHP中Magento\Setup\Model\ObjectManagerProvider::getObjectManagerFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManagerProvider::getObjectManagerFactory方法的具体用法?PHP ObjectManagerProvider::getObjectManagerFactory怎么用?PHP ObjectManagerProvider::getObjectManagerFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Setup\Model\ObjectManagerProvider
的用法示例。
在下文中一共展示了ObjectManagerProvider::getObjectManagerFactory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!$this->deploymentConfig->isAvailable()) {
$output->writeln("<info>You need to install the Magento application before running this utility.</info>");
return;
}
$options = $input->getOptions();
$languages = $input->getArgument(self::LANGUAGE_OPTION);
foreach ($languages as $lang) {
if (!$this->validator->isValid($lang)) {
throw new \InvalidArgumentException(
$lang . ' argument has invalid value, please run info:language:list for list of available locales'
);
}
}
try {
$objectManager = $this->objectManagerProvider->get();
// run the deployment logic
$filesUtil = $objectManager->create(
'\Magento\Framework\App\Utility\Files',
['pathToSource' => BP]
);
$objectManagerFactory = $this->objectManagerProvider->getObjectManagerFactory();
/** @var \Magento\Setup\Model\Deployer $deployer */
$deployer = $objectManager->create(
'Magento\Setup\Model\Deployer',
['filesUtil' => $filesUtil, 'output' => $output, 'isDryRun' => $options[self::DRY_RUN_OPTION]]
);
$deployer->deploy($objectManagerFactory, $languages);
} catch (\Exception $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>>');
if ($output->isVerbose()) {
$output->writeln($e->getTraceAsString());
}
return;
}
}