function getPortfolioList($offset = 0, $limit = null) { $qry = 'SELECT portfolio.* ' . 'FROM portfolio ' . 'WHERE owner = %d ' . 'ORDER BY created DESC '; if ($offset > 0 && !is_null($limit)) { if ($offset) { if (common_config('db', 'type') == 'pgsql') { $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; } else { $qry .= ' LIMIT ' . $offset . ', ' . $limit; } } } $portfolio = new Portfolio(); $cnt = $portfolio->query(sprintf($qry, $this->id)); return $portfolio; }