Пример #1
0
 public final function _getItemDbQuery($query, $cacheKey = null, array $fields = array())
 {
     $db = $this->_getDbInstance();
     $cache = $this->_getCacheInstance();
     $logger = $this->_getLogInstance();
     // new dbQuery
     $dbQuery = new BaseZF_Item_Db_Query($query, $cacheKey, $db, $cache, $logger);
     $dbQuery->setQueryFields($fields);
     $dbQuery->setCacheExpire($this->_cacheExpire);
     $dbQuery->setRealTime($this->isRealTime());
     return $dbQuery;
 }
Пример #2
0
 /**
  * Load item columns value from database
  *
  * @param array $ids
  * @param mixed
  * @param int
  *
  * @return array
  */
 protected function _loadData($ids, $realTime = null, $cacheExpire = BaseZF_Item_Db_Query::EXPIRE_NEVER)
 {
     // get ressources instances
     $db = $this->_getDbInstance();
     $cache = $this->_getCacheInstance();
     $logger = $this->_getLogInstance();
     // get query params
     $primaryKey = $this->getColumnPrimaryKey();
     $fields = $this->getColumnsNames();
     $query = $this->_getQuery();
     $cacheKeyTemplate = $this->_getCacheKey(self::CACHE_KEY_TEMPLATE);
     if ($realTime === null) {
         $realTime = $this->isRealTime();
     }
     // new dbQuery
     $dbQuery = new BaseZF_Item_Db_Query($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_Item_Db_Query_Exception_NoResults $e) {
         $data = array();
     }
     // free dbQuery Instance
     unset($dbQuery);
     return $data;
 }