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


PHP ObjectManager::getInstance方法代码示例

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


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

示例1: getProductOptionRepository

 /**
  * Return ProductCustomOptionRepository
  *
  * @return ProductCustomOptionRepositoryInterface
  * @deprecated
  */
 private function getProductOptionRepository()
 {
     if (!$this->productOptionRepository) {
         $this->productOptionRepository = ObjectManager::getInstance()->get(ProductCustomOptionRepositoryInterface::class);
     }
     return $this->productOptionRepository;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:FinalPrice.php

示例2: __wakeup

 public function __wakeup()
 {
     $this->pluginLocator = \Magento\Framework\App\ObjectManager::getInstance();
     $this->pluginList = $this->pluginLocator->get('Magento\\Framework\\Interception\\PluginList');
     $this->chain = $this->pluginLocator->get('Magento\\Framework\\Interception\\Chain');
     $this->subjectType = get_parent_class($this);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:7,代码来源:SourceClassWithNamespaceInterceptor.php

示例3: getOrderCollectionFactory

 /**
  * @return CollectionFactoryInterface
  *
  * @deprecated
  */
 private function getOrderCollectionFactory()
 {
     if ($this->orderCollectionFactory === null) {
         $this->orderCollectionFactory = ObjectManager::getInstance()->get(CollectionFactoryInterface::class);
     }
     return $this->orderCollectionFactory;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:History.php

示例4: getValidator

 /**
  * Get config validator
  *
  * @return Design\Config\Validator
  *
  * @deprecated
  */
 private function getValidator()
 {
     if (null === $this->validator) {
         $this->validator = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Theme\Model\Design\Config\Validator::class);
     }
     return $this->validator;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:DesignConfigRepository.php

示例5: isAuthorized

 public function isAuthorized()
 {
     $om = \Magento\Framework\App\ObjectManager::getInstance();
     $session = $om->get('Magento\\Framework\\App\\Http\\Context');
     $isLoggedIn = $session->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
     return $isLoggedIn;
 }
开发者ID:V3N0m21,项目名称:test-example,代码行数:7,代码来源:TestimonialList.php

示例6: getFormKeyValidator

 /**
  * @return \Magento\Framework\Data\Form\FormKey\Validator
  * @deprecated
  */
 private function getFormKeyValidator()
 {
     if (!$this->formKeyValidator) {
         $this->formKeyValidator = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Data\Form\FormKey\Validator::class);
     }
     return $this->formKeyValidator;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:RemoveItem.php

示例7: getDataPersistor

 /**
  * Get Data Persistor
  *
  * @return DataPersistorInterface
  */
 private function getDataPersistor()
 {
     if ($this->dataPersistor === null) {
         $this->dataPersistor = ObjectManager::getInstance()->get(DataPersistorInterface::class);
     }
     return $this->dataPersistor;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:CheckContactUsFormObserver.php

示例8: getImageUploader

 /**
  * Get image uploader
  *
  * @return \Magento\Catalog\Model\ImageUploader
  *
  * @deprecated
  */
 private function getImageUploader()
 {
     if ($this->imageUploader === null) {
         $this->imageUploader = \Magento\Framework\App\ObjectManager::getInstance()->get('Fastgento\\Storelocator\\LocationImageUpload');
     }
     return $this->imageUploader;
 }
开发者ID:ant-workaholic,项目名称:Store-locator,代码行数:14,代码来源:Save.php

示例9: _construct

 protected function _construct()
 {
     if ($this->checkConfig()) {
         $page = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\\Framework\\View\\Page\\Config');
         $page->addPageAsset('Mageplaza_Blog::css/index/mp.css');
     }
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:7,代码来源:Init.php

示例10: getCustomerId

 public function getCustomerId()
 {
     $om = \Magento\Framework\App\ObjectManager::getInstance();
     $session = $om->get('Magento\\Customer\\Model\\Session')->getCustomerId();
     //$customerId = $session->getId();
     return $session;
 }
开发者ID:V3N0m21,项目名称:test-example,代码行数:7,代码来源:TestimonialCreate.php

示例11: getOptionRepository

 /**
  * @return Option\Repository
  */
 private function getOptionRepository()
 {
     if (null === $this->optionRepository) {
         $this->optionRepository = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\\Catalog\\Model\\Product\\Option\\Repository');
     }
     return $this->optionRepository;
 }
开发者ID:rafaelstz,项目名称:magento2,代码行数:10,代码来源:Copier.php

示例12: _construct

 protected function _construct()
 {
     $this->_init('Celebros\\Celexport\\Model\\ResourceModel\\Cronlog');
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $this->_timezone = $objectManager->create('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $this->helper = $objectManager->create('Celebros\\Celexport\\Helper\\Data');
 }
开发者ID:CelebrosLtd,项目名称:M2_Celexport,代码行数:7,代码来源:Cronlog.php

示例13: getMetadataPool

 /**
  * Get MetadataPool instance
  * @return MetadataPool
  */
 private function getMetadataPool()
 {
     if (!$this->metadataPool) {
         $this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class);
     }
     return $this->metadataPool;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:LockValidator.php

示例14: getMathRandom

 /**
  * @return \Magento\Framework\Math\Random
  *
  * @deprecated
  */
 private function getMathRandom()
 {
     if ($this->mathRandom === null) {
         $this->mathRandom = \Magento\Framework\App\ObjectManager::getInstance()->get('\\Magento\\Framework\\Math\\Random');
     }
     return $this->mathRandom;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:Widget.php

示例15: getNameFinder

 /**
  * The getter function to get the new NameFinder dependency
  *
  * @return NameFinder
  *
  * @deprecated
  */
 private function getNameFinder()
 {
     if ($this->nameFinder === null) {
         $this->nameFinder = \Magento\Framework\App\ObjectManager::getInstance()->get('\\Magento\\Framework\\Reflection\\NameFinder');
     }
     return $this->nameFinder;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:TypeProcessor.php


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