/** * @param $tables * * @return \CDbCommand */ public function from($tables) { $tables = $this->getConnection()->addTablePrefix($tables); return parent::from($tables); }
/** * @param $tables * @return \CDbCommand */ public function from($tables) { $tables = DbHelper::addTablePrefix($tables); return parent::from($tables); }
private static function fetchPosts(CDbCommand $cmd) { $cmd->from(TABLE_POST)->select(array('id', 'title', 'thumbnail', 'summary', 'content', 'create_time'))->order(array('create_time desc', 'id desc'))->limit(self::POST_COUNT); $rows = $cmd->queryAll(); return $rows; }
/** * Executes the SQL statement and returns all rows. * @param CDbCommand $cmd * @param array $params * @param boolean $fetchAssociative * @return array the record found. An empty array if none is found. */ public function queryAll(CDbCommand $cmd, $params = array(), $fetchAssociative = true) { $this->beforeFind(); $cmd->from($this->table() . ' t'); return $cmd->queryAll($fetchAssociative, $params); }