/** * {@inheritdoc} * * @param integer|string|object $fetchType * @return integer|string|array */ public function execute($fetchType = null) { if (!$fetchType) { $fetchType = $this->fetchType; } switch ($fetchType) { case !is_int($fetchType): return Db::fetchObjects($this->getSQL(), $this->params, $fetchType); case \PDO::FETCH_CLASS: return Db::fetchObjects($this->getSQL(), $this->params); case \PDO::FETCH_ASSOC: default: return Db::fetchAll($this->getSQL(), $this->params); } }
/** * Fetch all rows from table * Be carefully with this method, can be very slow * * @return array of rows results in FETCH_CLASS mode */ public static function fetchAll() { $self = static::getInstance(); return DbProxy::fetchObjects($self->select, [], $self->rowClass); }