_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 getAuthorTypes() { return $this->_authorTypes; } public function getAuthorName($id, $type) { if (in_array($type, $this->_authorTypes)) { if ('admin' == $type) { $table = $this->_getTable('Admin'); } else { $table = $this->_getTable('User'); } if (($author = $table->findRow($id))) { return $author['firstName'] . ' ' . $author['lastName']; } } $select = $this->_db->select(); $select->from($this->_getPair(), ['author']); $select->where('`authorId` = ?', $id, Qs_Db::INT_TYPE); $select->where('`enabled` = "y"'); $select->limit(1); $select->order('id DESC'); 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( 'categoryAlias' => 'alias', 'categoryEnabled' => 'enabled') ); Qs_Db::joinTranslation( $this->_select, 'PostCategory', $this->getLanguage(), 'PostCategoryContent', array('categoryTitle' => 'title') ); } 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; } }