/** * Return ProductCustomOptionRepository * * @return ProductCustomOptionRepositoryInterface * @deprecated */ private function getProductOptionRepository() { if (!$this->productOptionRepository) { $this->productOptionRepository = ObjectManager::getInstance()->get(ProductCustomOptionRepositoryInterface::class); } return $this->productOptionRepository; }
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); }
/** * @return CollectionFactoryInterface * * @deprecated */ private function getOrderCollectionFactory() { if ($this->orderCollectionFactory === null) { $this->orderCollectionFactory = ObjectManager::getInstance()->get(CollectionFactoryInterface::class); } return $this->orderCollectionFactory; }
/** * 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; }
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; }
/** * @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; }
/** * Get Data Persistor * * @return DataPersistorInterface */ private function getDataPersistor() { if ($this->dataPersistor === null) { $this->dataPersistor = ObjectManager::getInstance()->get(DataPersistorInterface::class); } return $this->dataPersistor; }
/** * 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; }
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'); } }
public function getCustomerId() { $om = \Magento\Framework\App\ObjectManager::getInstance(); $session = $om->get('Magento\\Customer\\Model\\Session')->getCustomerId(); //$customerId = $session->getId(); return $session; }
/** * @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; }
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'); }
/** * Get MetadataPool instance * @return MetadataPool */ private function getMetadataPool() { if (!$this->metadataPool) { $this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); } return $this->metadataPool; }
/** * @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; }
/** * 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; }
/** * The getter function to get the attributeHelper for real application code * * @deprecated * * @return Attribute */ private function getAttributeHelper() { if ($this->attributeHelper === null) { $this->attributeHelper = ObjectManager::getInstance()->get('Magento\\Eav\\Model\\Entity\\Attribute'); } return $this->attributeHelper; }
/** * @return RequestInterface */ private function getRequest() { if ($this->request === null) { $this->request = \Magento\Framework\App\ObjectManager::getInstance()->get(RequestInterface::class); } return $this->request; }
public function getItmeProductThumbnailUrl() { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $thumbnailHelper = $objectManager->get('Magento\\Catalog\\Helper\\Image'); $thumbnail = $thumbnailHelper->init($this->getItmeProduct(), 'thumbnail')->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)->setImageFile($this->getItmeProduct()->getImage())->resize('160', '160')->getUrl(); return $thumbnail; }
/** * @return AnchorUrlRewriteGenerator * * @deprecated */ private function getAnchorUrlRewriteGenerator() { if ($this->anchorUrlRewriteGenerator === null) { $this->anchorUrlRewriteGenerator = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\\CatalogUrlRewrite\\Model\\Product\\AnchorUrlRewriteGenerator'); } return $this->anchorUrlRewriteGenerator; }
/** * Get image uploader * * @return \Magento\Catalog\Model\ImageUploader * * @deprecated */ private function getImageUploader() { if ($this->imageUploader === null) { $this->imageUploader = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\\Catalog\\CategoryImageUpload'); } return $this->imageUploader; }
/** * Retrieve cookie metadata factory * * @deprecated * @return CookieMetadataFactory */ private function getCookieMetadataFactory() { if (!$this->cookieMetadataFactory) { $this->cookieMetadataFactory = ObjectManager::getInstance()->get(CookieMetadataFactory::class); } return $this->cookieMetadataFactory; }
/** * Tests that the session handler is correctly set when object is created. * * @dataProvider saveHandlerProvider * @param string $deploymentConfigHandler * @param string $iniHandler */ public function testSetSaveHandler($deploymentConfigHandler, $iniHandler) { // Set expected session.save_handler config if ($deploymentConfigHandler) { if ($deploymentConfigHandler !== 'files') { $expected = 'user'; } else { $expected = $deploymentConfigHandler; } } else { if ($iniHandler) { $expected = $iniHandler; } else { $expected = SaveHandlerInterface::DEFAULT_HANDLER; } } // Set ini configuration if ($iniHandler) { ini_set('session.save_handler', $iniHandler); } /** @var DeploymentConfig | \PHPUnit_Framework_MockObject_MockObject $deploymentConfigMock */ $deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class)->disableOriginalConstructor()->getMock(); $deploymentConfigMock->expects($this->once())->method('get')->with(Config::PARAM_SESSION_SAVE_METHOD, SaveHandlerInterface::DEFAULT_HANDLER)->willReturn($deploymentConfigHandler ?: SaveHandlerInterface::DEFAULT_HANDLER); new SaveHandler(ObjectManager::getInstance()->get(SaveHandlerFactory::class), $deploymentConfigMock); // Test expectation $this->assertEquals($expected, ObjectManager::getInstance()->get(ConfigInterface::class)->getOption('session.save_handler')); }
/** * {@inheritdoc} */ public function __wakeup() { parent::__wakeup(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $this->_resource = $objectManager->get('Magento\\Authorization\\Model\\ResourceModel\\Role'); $this->_resourceCollection = $objectManager->get('Magento\\Authorization\\Model\\ResourceModel\\Role\\Collection'); }
/** * @return ObjectManager */ private function initObjectManager() { if (is_null($this->objectManager)) { $this->objectManager = ObjectManager::getInstance(); } return $this->objectManager; }
/** * Get HttpClientFactory dependency * * @return \Magento\Framework\HTTP\ZendClientFactory * * @deprecated */ private function getHttpClientFactory() { if ($this->httpClientFactory === null) { $this->httpClientFactory = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\\Framework\\HTTP\\ZendClientFactory'); } return $this->httpClientFactory; }
/** * Prepare form fields * * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { $form = $this->_formFactory->create(); $form->setHtmlIdPrefix('manufacturer_'); $form->setFieldNameSuffix('manufacturer'); $model = $this->_coreRegistry->registry('manufacturer_manufacturer'); $om = \Magento\Framework\App\ObjectManager::getInstance(); $reader = $om->get('Magento\\Eav\\Model\\Config')->getAttribute('catalog_product', 'manufacturer'); $attributeOptions = $reader->getSource()->getAllOptions(true, true); $default = array('value' => '', 'label' => 'Choose Brand'); $i = 0; $manufacturer[$i] = $default; foreach ($attributeOptions as $key => $value) { $i++; if ($key != 0) { $manufacturer[$i] = $value; //$name[$i] = $value['label']; } } $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('General')]); if ($model->getId()) { $fieldset->addField('id', 'hidden', ['name' => 'id']); } $fieldset->addField('mfc_id', 'select', ['name' => 'mfc_id', 'label' => __('Manufacturer'), 'required' => true, 'values' => $manufacturer]); $fieldset->addField('status', 'select', ['name' => 'status', 'label' => __('Status'), 'options' => $this->_manufacturerStatus->toOptionArray()]); $fieldset->addField('position', 'textarea', ['name' => 'position', 'label' => __('Position'), 'required' => true, 'style' => 'height: 15em; width: 30em;']); $fieldset->addField('image_path', 'image', array('name' => 'image_path', 'label' => __('Image'), 'title' => __('Image'))); $wysiwygConfig = $this->_wysiwygConfig->getConfig(); $fieldset->addField('description', 'editor', ['name' => 'description', 'label' => __('Description'), 'required' => true, 'config' => $wysiwygConfig]); $data = $model->getData(); $form->setValues($data); $this->setForm($form); return parent::_prepareForm(); }
/** * The getter function to get the new RuleFactory dependency * * @return \Magento\SalesRule\Model\RuleFactory * * @deprecated */ private function getRuleFactory() { if ($this->ruleFactory === null) { $this->ruleFactory = ObjectManager::getInstance()->get('Magento\\SalesRule\\Model\\RuleFactory'); } return $this->ruleFactory; }
public function createTestimonialAction() { $data = $this->getRequest()->getPost(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $testimonial = $objectManager->get('V3N0m21\\Testimonials\\Model\\Testimonial'); $testimonial->setId(); }
public function execute() { $result = $this->resultJsonFactory->create(); $data = array(); try { $params = $this->getRequest()->getParams(); if (isset($params['lastid']) && isset($params['limit'])) { $lastId = $params['lastid']; $limit = $params['limit']; $isadmin = isset($params['isadmin']) ? $params['isadmin'] : false; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $raaDataHelper = $objectManager->create('Retail\\Analytics\\Helper\\Data'); $width = $raaDataHelper->getImageWidth(); $height = $raaDataHelper->getImageHeight(); $imagetype = "small_image"; if (isset($params['width']) && $params['width'] != null && $params['width'] != "") { $width = $params['width']; } if (isset($params['height']) && $params['height'] != null && $params['height'] != "") { $height = $params['height']; } if (isset($params['imagetype']) && $params['imagetype'] != null && $params['imagetype'] != "") { $imagetype = $params['imagetype']; } $producCollection = new \Retail\Analytics\Model\Product(); $data = $producCollection->getProductFinalPrice($lastId, $limit, $imagetype, $width, $height, $isadmin); return $result->setData($data); } } catch (Exception $e) { return $result->setData($data); } }
/** * Gets base URL checker. * * @return \Magento\Store\Model\BaseUrlChecker * @deprecated */ private function getBaseUrlChecker() { if ($this->baseUrlChecker === null) { $this->baseUrlChecker = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\\Store\\Model\\BaseUrlChecker'); } return $this->baseUrlChecker; }