function find($criteria = null, $order = null, $limit = 1000, $from = 0) { $result = $this->database->query($this->buildFindQuery($criteria, $order, $limit, $from)); if (!is_null($result->getError())) { return $result->getError(); } $reportss = array(); while ($row = $result->fetchRow()) { $reports = new Reports(); $value = $row[0]; $reports->setId($value); $value = $row[1]; $reports->setName($value); $value = $row[2]; $reports->setCode($value); $value = $row[3]; $reports->setClients($value); $value = $row[4]; $reports->setOwner($value); $value = $row[5]; $reports->setPeriod_from($value); $value = $row[6]; $reports->setPeriod_to($value); $value = $row[7]; $reports->setAdd_date($value); if ($order != null) { array_push($reportss, $reports); } else { $reportss[$reports->getId()] = $reports; } } return $reportss; }