/** * Creates a currency instance. * * @param CacheInterface $appCache * @param string|array $options Options array or currency short name when string is given * @param string $locale Locale name */ public function __construct(CacheInterface $appCache, $options = null, $locale = null) { // set Zend cache to low level frontend app cache $lowLevelFrontendCache = $appCache->getFrontend()->getLowLevelFrontend(); \Zend_Currency::setCache($lowLevelFrontendCache); parent::__construct($options, $locale); }
/** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param string $connectionName */ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Framework\App\CacheInterface $cache, \Magento\Framework\Stdlib\DateTime $dateTime, $connectionName = null ) { $this->dateTime = $dateTime; parent::__construct($context, $connectionName); $this->_cache = $cache->getFrontend(); }
/** * {@inheritdoc} */ public function getLocale() { if (!$this->_locale) { \Zend_Locale_Data::setCache($this->_cache->getFrontend()->getLowLevelFrontend()); $this->_locale = $this->_localeFactory->create(array('locale' => $this->getLocaleCode())); } elseif ($this->_locale->__toString() != $this->_localeCode) { $this->setLocale($this->_localeCode); } return $this->_locale; }
/** * Retrieve connection to resource specified by $resourceName * * @param string $resourceName * @return \Magento\Framework\DB\Adapter\AdapterInterface|false */ public function getConnection($resourceName) { $connectionName = $this->_config->getConnectionName($resourceName); if (isset($this->_connections[$connectionName])) { return $this->_connections[$connectionName]; } $connection = $this->_connectionFactory->create($connectionName); if (!$connection) { return false; } $connection->setCacheAdapter($this->_cache->getFrontend()); $this->_connections[$connectionName] = $connection; return $connection; }
/** * @param \Magento\Framework\App\Resource $resource * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Framework\Stdlib\DateTime $dateTime */ public function __construct(\Magento\Framework\App\Resource $resource, \Magento\Framework\App\CacheInterface $cache, \Magento\Framework\Stdlib\DateTime $dateTime) { $this->dateTime = $dateTime; parent::__construct($resource); $this->_cache = $cache->getFrontend(); }