query = $query; } //findLatests public function getLatests(int $maxResults = 0, $query = null): array { if (is_null($query)) { $query = $this->query->create(); } $query ->filterIsOnline() ->orderBy('.date', 'DESC'); if ($maxResults) { $query ->limit($maxResults); } return $query->find(); } public function findLatests($maxResults = 0) { $result = $this->findByMerchantQuery() ->orderBy('e.date', 'DESC'); $result->andWhere('e.status = 1'); if ($maxResults) { $result->setMaxResults($maxResults); } return $result->getQuery()->getResult(); } }