public static function setLoggerInstance($logger) { self::$_LOGGER = $logger; }
public final function _getDbQuery($query, $cacheKey = null, array $fields = array()) { $db = $this->_getDbInstance(); $cache = $this->_getCacheInstance(); $logger = $this->_getLoggerInstance(); // new dbQuery $dbQuery = new BaseZF_DbQuery($query, $cacheKey, $db, $cache, $logger); $dbQuery->setQueryFields($fields); $dbQuery->setCacheExpire($this->_cacheExpire); $dbQuery->setRealTime($this->isRealTime()); return $dbQuery; }
/** * */ protected function _loadData($ids, $realTime = null, $cacheExpire = BaseZF_DbQuery::EXPIRE_NEVER) { $db = $this->_getDbInstance(); $cache = $this->_getCacheInstance(); $logger = $this->_getLoggerInstance(); $primaryKey = $this->getPrimaryKey(); $query = $this->_getQuery(); $fields = array_keys($this->_structure['fields']); $cacheKeyTemplate = $this->_getCacheKey(self::CACHE_KEY_TEMPLATE); if ($realTime === null) { $realTime = $this->isRealTime(); } // new dbQuery $dbQuery = new BaseZF_DbQuery($query, $cacheKeyTemplate, $db, $cache, $logger); $dbQuery->setQueryFields($fields); $dbQuery->setCacheExpire($cacheExpire); $dbQuery->setRealTime($realTime); $dbQuery->bindValue($primaryKey, $ids); $dbQuery->setCacheKeyByRows($primaryKey, self::CACHE_KEY_TEMPLATE); try { $dbQuery->execute(); $data = $dbQuery->fetchAll(); } catch (BaseZF_DbQuery_Exception_NoResults $e) { $data = array(); } // free dbQuery Instance unset($dbQuery); return $data; }