public function getUserFollowing($id, $user_id) { $id = (int) $id; $userId = (int) $user_id; $query = sprintf("SELECT * FROM %s WHERE {$this->quoteColumnName('id')} = ? AND {$this->quoteColumnName('userId')} = ?;", self::TABLE_NAME); $rowset = $this->dbAdapter->prepareExecuteAndFetch($query, array($id, $userId)); $following = null; if (count($rowset) > 0) { $following = new Following($rowset[0]); } return $following; }