本文整理汇总了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;
}
示例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);
}
示例3: getOrderCollectionFactory
/**
* @return CollectionFactoryInterface
*
* @deprecated
*/
private function getOrderCollectionFactory()
{
if ($this->orderCollectionFactory === null) {
$this->orderCollectionFactory = ObjectManager::getInstance()->get(CollectionFactoryInterface::class);
}
return $this->orderCollectionFactory;
}
示例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;
}
示例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;
}
示例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;
}
示例7: getDataPersistor
/**
* Get Data Persistor
*
* @return DataPersistorInterface
*/
private function getDataPersistor()
{
if ($this->dataPersistor === null) {
$this->dataPersistor = ObjectManager::getInstance()->get(DataPersistorInterface::class);
}
return $this->dataPersistor;
}
示例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;
}
示例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');
}
}
示例10: getCustomerId
public function getCustomerId()
{
$om = \Magento\Framework\App\ObjectManager::getInstance();
$session = $om->get('Magento\\Customer\\Model\\Session')->getCustomerId();
//$customerId = $session->getId();
return $session;
}
示例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;
}
示例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');
}
示例13: getMetadataPool
/**
* Get MetadataPool instance
* @return MetadataPool
*/
private function getMetadataPool()
{
if (!$this->metadataPool) {
$this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class);
}
return $this->metadataPool;
}
示例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;
}
示例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;
}