当前位置: 首页>>代码示例>>PHP>>正文


PHP Bootstrap::createObjectManagerFactory方法代码示例

本文整理汇总了PHP中Magento\Framework\App\Bootstrap::createObjectManagerFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap::createObjectManagerFactory方法的具体用法?PHP Bootstrap::createObjectManagerFactory怎么用?PHP Bootstrap::createObjectManagerFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\App\Bootstrap的用法示例。


在下文中一共展示了Bootstrap::createObjectManagerFactory方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initObjectManager

 /**
  * Initialize Magento ObjectManager.
  *
  * @return void
  */
 protected function initObjectManager()
 {
     if (!$this->magentoObjectManager) {
         $objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
         $this->magentoObjectManager = $objectManagerFactory->create($_SERVER);
     }
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:12,代码来源:SequenceSorter.php

示例2: getObjectManagerFactory

 /**
  * Returns ObjectManagerFactory
  *
  * @param array $initParams
  * @return \Magento\Framework\App\ObjectManagerFactory
  */
 public function getObjectManagerFactory($initParams = [])
 {
     return Bootstrap::createObjectManagerFactory(
         BP,
         $initParams
     );
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:ObjectManagerProvider.php

示例3: tearDown

 protected function tearDown()
 {
     unset($this->model);
     $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
     $objectManager = $magentoObjectManagerFactory->create($_SERVER);
     \Magento\Framework\App\ObjectManager::setInstance($objectManager);
 }
开发者ID:nja78,项目名称:magento2,代码行数:7,代码来源:HttpTest.php

示例4: createProcessor

 /**
  * Create Processor
  *
  * @return Processor
  */
 public function createProcessor()
 {
     $objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
     $objectManager = $objectManagerFactory->create($_SERVER);
     $response = $objectManager->create('Magento\\Framework\\App\\Response\\Http');
     return new Processor($response);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:processorFactory.php

示例5: get

 /**
  * Retrieve object manager.
  *
  * @return \Magento\Framework\ObjectManagerInterface
  * @throws \Magento\Setup\Exception
  */
 public function get()
 {
     if (null === $this->objectManager) {
         $initParams = $this->serviceLocator->get(InitParamListener::BOOTSTRAP_PARAM);
         $factory = Bootstrap::createObjectManagerFactory(BP, $initParams);
         $this->objectManager = $factory->create($initParams);
     }
     return $this->objectManager;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:15,代码来源:ObjectManagerProvider.php

示例6: setUp

 public function setUp()
 {
     $this->mockViewFilesystem = $this->getMockBuilder('\\Magento\\Framework\\View\\FileSystem')->disableOriginalConstructor()->getMock();
     $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
     $objectManagerMock->expects($this->once())->method('get')->with('Magento\\Email\\Model\\Resource\\Template')->will($this->returnValue($objectManagerHelper->getObject('Magento\\Email\\Model\\Resource\\Template')));
     try {
         $this->objectManagerBackup = \Magento\Framework\App\ObjectManager::getInstance();
     } catch (\RuntimeException $e) {
         $this->objectManagerBackup = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER)->create($_SERVER);
     }
     \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock);
     $this->template = $objectManagerHelper->getObject('Magento\\Sales\\Model\\Email\\Template', ['viewFileSystem' => $this->mockViewFilesystem]);
 }
开发者ID:kid17,项目名称:magento2,代码行数:14,代码来源:TemplateTest.php

示例7: setUp

 protected function setUp()
 {
     $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->scopeConfigMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->scopeConfigMock->expects($this->any())->method('getValue')->willReturn(['test' => 1]);
     $this->structureMock = $this->getMock('Magento\\Config\\Model\\Config\\Structure', [], [], '', false);
     $this->structureMock->expects($this->any())->method('getFieldPathsByAttribute')->willReturn(['path' => 'test']);
     $this->resourceModelMock = $this->getMock('Magento\\Email\\Model\\Resource\\Template', [], [], '', false);
     $this->resourceModelMock->expects($this->any())->method('getSystemConfigByPathsAndTemplateId')->willReturn(['test_config' => 2015]);
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
     $objectManagerMock->expects($this->any())->method('get')->with('Magento\\Email\\Model\\Resource\\Template')->will($this->returnValue($this->resourceModelMock));
     try {
         $this->objectManagerBackup = \Magento\Framework\App\ObjectManager::getInstance();
     } catch (\RuntimeException $e) {
         $this->objectManagerBackup = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER)->create($_SERVER);
     }
     \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock);
     $this->model = $helper->getObject('Magento\\Email\\Model\\BackendTemplate', ['scopeConfig' => $this->scopeConfigMock, 'structure' => $this->structureMock]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:19,代码来源:BackendTemplateTest.php

示例8: setUp

 protected function setUp()
 {
     $this->entityFactoryMock = $this->getMock('Magento\\Framework\\Data\\Collection\\EntityFactoryInterface');
     $this->loggerMock = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->fetchStrategyMock = $this->getMock('Magento\\Framework\\Data\\Collection\\Db\\FetchStrategyInterface');
     $this->managerMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface');
     $this->connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\Flag\\Resource', [], [], '', false);
     $this->resourceMock->expects($this->any())->method('getReadConnection')->will($this->returnValue($this->connectionMock));
     $this->selectMock = $this->getMock('Zend_Db_Select', ['getPart', 'setPart', 'from', 'columns'], [$this->connectionMock]);
     $this->connectionMock->expects($this->any())->method('select')->will($this->returnValue($this->selectMock));
     $this->objectManagerMock = $this->getMock('Magento\\Framework\\App\\ObjectManager', [], [], '', false);
     try {
         $this->objectManagerBackup = \Magento\Framework\App\ObjectManager::getInstance();
     } catch (\RuntimeException $e) {
         $this->objectManagerBackup = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER)->create($_SERVER);
     }
     \Magento\Framework\App\ObjectManager::setInstance($this->objectManagerMock);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->uut = $this->getUut();
 }
开发者ID:nja78,项目名称:magento2,代码行数:21,代码来源:AbstractCollectionTest.php

示例9: foreach

 $files['additional'] = [$opt->getOption('extra-classes-file')];
 $entities = [];
 $repositoryScanner = new Scanner\RepositoryScanner();
 $repositories = $repositoryScanner->collectEntities($files['di']);
 $scanner = new Scanner\CompositeScanner();
 $scanner->addChild(new Scanner\PhpScanner($log), 'php');
 $scanner->addChild(new Scanner\XmlScanner($log), 'di');
 $scanner->addChild(new Scanner\ArrayScanner(), 'additional');
 $entities = $scanner->collectEntities($files);
 $interceptorScanner = new Scanner\XmlInterceptorScanner();
 $entities['interceptors'] = $interceptorScanner->collectEntities($files['di']);
 // 1.2 Generation of Factory and Additional Classes
 $generatorIo = new \Magento\Framework\Code\Generator\Io(new \Magento\Framework\Filesystem\Driver\File(), $generationDir);
 $generator = new \Magento\Framework\Code\Generator($generatorIo, [Interceptor::ENTITY_TYPE => 'Magento\\Framework\\Interception\\Code\\Generator\\Interceptor', Proxy::ENTITY_TYPE => 'Magento\\Framework\\ObjectManager\\Code\\Generator\\Proxy', Factory::ENTITY_TYPE => 'Magento\\Framework\\ObjectManager\\Code\\Generator\\Factory', Mapper::ENTITY_TYPE => 'Magento\\Framework\\Api\\Code\\Generator\\Mapper', Persistor::ENTITY_TYPE => 'Magento\\Framework\\ObjectManager\\Code\\Generator\\Persistor', Repository::ENTITY_TYPE => 'Magento\\Framework\\ObjectManager\\Code\\Generator\\Repository', Converter::ENTITY_TYPE => 'Magento\\Framework\\ObjectManager\\Code\\Generator\\Converter', SearchResults::ENTITY_TYPE => 'Magento\\Framework\\Api\\Code\\Generator\\SearchResults', ExtensionAttributesInterfaceGenerator::ENTITY_TYPE => 'Magento\\Framework\\Api\\Code\\Generator\\ExtensionAttributesInterfaceGenerator', ExtensionAttributesGenerator::ENTITY_TYPE => 'Magento\\Framework\\Api\\Code\\Generator\\ExtensionAttributesGenerator']);
 /** Initialize object manager for code generation based on configs */
 $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
 $objectManager = $magentoObjectManagerFactory->create($_SERVER);
 $generator->setObjectManager($objectManager);
 $generatorAutoloader = new \Magento\Framework\Code\Generator\Autoloader($generator);
 spl_autoload_register([$generatorAutoloader, 'load']);
 foreach ($repositories as $entityName) {
     switch ($generator->generateClass($entityName)) {
         case \Magento\Framework\Code\Generator::GENERATION_SUCCESS:
             $log->add(Log::GENERATION_SUCCESS, $entityName);
             break;
         case \Magento\Framework\Code\Generator::GENERATION_ERROR:
             $log->add(Log::GENERATION_ERROR, $entityName);
             break;
         case \Magento\Framework\Code\Generator::GENERATION_SKIP:
         default:
             //no log
开发者ID:shabbirvividads,项目名称:magento2,代码行数:31,代码来源:compiler.php

示例10: testCreateObjectManagerFactory

 public function testCreateObjectManagerFactory()
 {
     $result = Bootstrap::createObjectManagerFactory('test', []);
     $this->assertInstanceOf('Magento\\Framework\\App\\ObjectManagerFactory', $result);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:5,代码来源:BootstrapTest.php

示例11: testCreateObjectManagerFactoryCouldBeOverridden

 /**
  * @expectedException \BadMethodCallException
  * @expectedExceptionMessage Magento\Framework\App\Test\Unit\ObjectManager\FactoryStub::__construct
  */
 public function testCreateObjectManagerFactoryCouldBeOverridden()
 {
     $rootPath = __DIR__ . '/_files/';
     $factory = Bootstrap::createObjectManagerFactory($rootPath, []);
     $factory->create([], false);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:10,代码来源:ObjectManagerFactoryTest.php

示例12: exit

        if (!preg_match('/^[a-z]{2}_[A-Z]{2}$/', $lang)) {
            echo USAGE;
            exit(1);
        }
    }
}
$isDryRun = isset($options['dry-run']);
$verbosity = \Magento\Tools\View\Deployer\Log::ERROR;
if (isset($options['verbose'])) {
    $verbosity = 0 === (int) $options['verbose'] ? \Magento\Tools\View\Deployer\Log::SILENT : \Magento\Tools\View\Deployer\Log::ERROR | \Magento\Tools\View\Deployer\Log::DEBUG;
}
$logger = new \Magento\Tools\View\Deployer\Log($verbosity);
try {
    // run the deployment logic
    $filesUtil = new \Magento\Framework\App\Utility\Files(BP);
    $omFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []);
    $objectManager = $omFactory->create([\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT]);
    /** @var \Magento\Framework\App\DeploymentConfig $deploymentConfig */
    $deploymentConfig = $objectManager->get('Magento\\Framework\\App\\DeploymentConfig');
    $isAppInstalled = $deploymentConfig->isAvailable();
    if (!$isAppInstalled) {
        throw new \Exception('You need to install the Magento application before running this utility.');
    }
    /** @var \Magento\Tools\View\Deployer $deployer */
    $deployer = $objectManager->create('Magento\\Tools\\View\\Deployer', ['filesUtil' => $filesUtil, 'logger' => $logger, 'isDryRun' => $isDryRun]);
    $deployer->deploy($omFactory, $langs);
} catch (\Exception $e) {
    $logger->logError($e->getMessage());
    $logger->logDebug($e->getTraceAsString());
    exit(1);
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:31,代码来源:deploy.php

示例13: getObjectManager

 /**
  * Get object manager
  *
  * @return \Magento\Framework\ObjectManagerInterface
  */
 public function getObjectManager()
 {
     if (!$this->objectManager) {
         $objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $this->initArguments);
         $this->objectManager = $objectManagerFactory->create($this->initArguments);
         $this->objectManager->get('Magento\\Framework\\App\\State')->setAreaCode(self::AREA_CODE);
     }
     return $this->objectManager;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:FixtureModel.php

示例14: getObjectManager

 /**
  * Get object manager for Magento application
  *
  * @return \Magento\Framework\ObjectManagerInterface
  */
 private function getObjectManager()
 {
     if (null === $this->objectManager) {
         $this->assertDeploymentConfigExists();
         $factory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $this->initParams);
         $this->objectManager = $factory->create($this->initParams);
     }
     return $this->objectManager;
 }
开发者ID:ViniciusAugusto,项目名称:magento2,代码行数:14,代码来源:Installer.php


注:本文中的Magento\Framework\App\Bootstrap::createObjectManagerFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。