_db->select(); $select->from($this->_getPair(), 'id'); $select->where('`alias` = ?', $alias); $select->limit(1); return $this->_db->fetchOne($select); } public function getAliasById($id) { $select = $this->_db->select(); $select->from($this->_getPair(), 'alias'); $select->where('id = ?', (string) $id, \Zend_Db::INT_TYPE); $select->limit(1); return $this->_db->fetchOne($select); } public function getListSelect() { if (null === $this->_select) { parent::getListSelect(); $this->_select->join( $this->_getPair('PostCategory'), "`PostCategory`.`id` = `{$this->_tableAlias}`.`categoryId`", array('categoryTitle' => 'title', 'categoryAlias' => 'alias', 'categoryEnabled' => 'enabled') ); } return $this->_select; } protected static function _getCacheObject($frontOp = array(), $backOp = array()) { $frontendOptions = array( 'caching' => true, 'cache_id_prefix' => 'blog_', 'automatic_serialization' => true, 'lifetime' => 3600 ); $backendOptions = array( 'cache_dir' => BASE_PATH . '/tmp/cache/' ); $frontendOptions = array_merge($frontendOptions, $frontOp); $backendOptions = array_merge($backendOptions, $backOp); return \Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); } public static function cleanCache($tags = array()) { $tags = (empty($tags)) ? array('blog') : $tags; $cache = self::_getCacheObject(); return $cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, $tags); } public function setUserInfo($data) { $this->_userInfo = $data; return $this; } public function getUserInfo($field = null, $default = null) { return Qs_Array::get($this->_userInfo, $field, $default); } }