當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。