@@ -19,12 +19,15 @@ class NewsRepository extends BaseRepository implements DefaultRepositoryInterfac | |||
return NewsInterface::class; | |||
} | |||
public function findLastNewsHome() | |||
public function findLatests($maxResults = 0) | |||
{ | |||
return $this->findByMerchantQuery() | |||
->orderBy('e.date', 'DESC') | |||
->setMaxResults(2) | |||
->getQuery() | |||
->getResult(); | |||
$result = $this->findByMerchantQuery() | |||
->orderBy('e.date', 'DESC') ; | |||
if($maxResults) { | |||
$result->setMaxResults($maxResults) ; | |||
} | |||
return $result->getQuery()->getResult() ; | |||
} | |||
} |