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


PHP ObjectManager::configure方法代码示例

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


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

示例1: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $config = new \Magento\Framework\ObjectManager\Config\Config();
     $factory = new \Magento\Framework\ObjectManager\Factory\Factory($config);
     self::$_objectManager = new \Magento\Framework\ObjectManager\ObjectManager($factory, $config);
     self::$_objectManager->configure(array('preferences' => array(self::TEST_INTERFACE => self::TEST_INTERFACE_IMPLEMENTATION)));
     $factory->setObjectManager(self::$_objectManager);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:8,代码来源:ObjectManagerTest.php

示例2: testProcess

 /**
  * @magentoConfigFixture current_store catalog/productalert/allow_price 1
  *
  * @magentoDataFixture Magento/ProductAlert/_files/product_alert.php
  */
 public function testProcess()
 {
     $this->_objectManager->configure(['Magento\\ProductAlert\\Model\\Observer' => ['arguments' => ['transportBuilder' => ['instance' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]], 'Magento\\ProductAlert\\Model\\Email' => ['arguments' => ['transportBuilder' => ['instance' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]], 'preferences' => ['Magento\\Framework\\Mail\\TransportInterface' => 'Magento\\TestFramework\\Mail\\TransportInterfaceMock', 'Magento\\TestFramework\\Mail\\Template\\TransportBuilder' => 'Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock']]);
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
     $observer = $this->_objectManager->get('Magento\\ProductAlert\\Model\\Observer');
     $observer->process();
     /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */
     $transportBuilder = $this->_objectManager->get('Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock');
     $this->assertStringMatchesFormat('%AHello %A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . ',%A', $transportBuilder->getSentMessage()->getBodyHtml()->getContent());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:15,代码来源:ObserverTest.php

示例3: launch

 /**
  * Run application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $areaCode = 'install';
     $this->_state->setAreaCode($areaCode);
     $this->_objectManager->configure($this->_loader->load($areaCode));
     if (isset($this->_arguments['uninstall'])) {
         $sessionConsole = $this->_objectManager->create('\\Magento\\Framework\\Session\\SessionConsole');
         $installerModel = $this->_objectManager->create('Magento\\Install\\Model\\Installer', ['session' => $sessionConsole]);
         $installer = $this->_installerFactory->create(['installArgs' => $this->_arguments, 'installer' => $installerModel]);
     } else {
         $installer = $this->_installerFactory->create(array('installArgs' => $this->_arguments));
     }
     if (isset($this->_arguments['show_locales'])) {
         $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableLocales()));
     } elseif (isset($this->_arguments['show_currencies'])) {
         $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableCurrencies()));
     } elseif (isset($this->_arguments['show_timezones'])) {
         $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableTimezones()));
     } elseif (isset($this->_arguments['show_install_options'])) {
         $this->_output->readableOutput(PHP_EOL . 'Required parameters:');
         $this->_output->readableOutput($this->_output->alignArrayKeys($installer->getRequiredParams()));
         $this->_output->readableOutput(PHP_EOL . 'Optional parameters:');
         $this->_output->readableOutput($this->_output->alignArrayKeys($installer->getOptionalParams()));
         $this->_output->readableOutput(PHP_EOL . 'Flag values are considered positive if set to 1, y, true or yes.' . 'Any other value is considered as negative.' . PHP_EOL);
     } else {
         $this->_handleInstall($installer);
     }
     $this->_response->setCode(0);
     return $this->_response;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:35,代码来源:Console.php

示例4: launch

 /**
  * Run application
  *
  * @return ResponseInterface
  */
 public function launch()
 {
     $areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName());
     $this->_state->setAreaCode($areaCode);
     $this->_objectManager->configure($this->_configLoader->load($areaCode));
     $this->_response = $this->_objectManager->get('Magento\\Framework\\App\\FrontControllerInterface')->dispatch($this->_request);
     // This event gives possibility to launch something before sending output (allow cookie setting)
     $eventParams = array('request' => $this->_request, 'response' => $this->_response);
     $this->_eventManager->dispatch('controller_front_send_response_before', $eventParams);
     return $this->_response;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:16,代码来源:Http.php

示例5: configure

 /**
  * Configure Object Manager
  * This method is static to have the ability to configure multiple instances of Object manager when needed
  *
  * @param MagentoObjectManager $objectManager
  */
 public static function configure(MagentoObjectManager $objectManager)
 {
     $objectManager->configure($objectManager->get('Mtf\\ObjectManager\\ConfigLoader\\Primary')->load());
     $objectManager->configure($objectManager->get('Mtf\\ObjectManager\\ConfigLoader\\Module')->load());
     $objectManager->configure($objectManager->get('Mtf\\ObjectManager\\ConfigLoader\\Module')->load('etc/ui'));
     $objectManager->configure($objectManager->get('Mtf\\ObjectManager\\ConfigLoader\\Module')->load('etc/curl'));
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:ObjectManagerFactory.php

示例6: replaceClassName

 /**
  * Replace name of url model
  *
  * @param string $className
  * @return $this
  */
 public function replaceClassName($className)
 {
     $this->_objectManager->configure(array('preferences' => array(self::CLASS_NAME => $className)));
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:Factory.php

示例7: emulateLayoutArea

 /**
  * @param string $areaCode
  * @return void
  */
 public function emulateLayoutArea($areaCode)
 {
     $configuration = array('Magento\\Framework\\View\\Layout' => array('arguments' => array('area' => $areaCode)));
     $this->_objectManager->configure($configuration);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:9,代码来源:AreaEmulator.php


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