|
- <?php
-
- namespace Lc\SovBundle\Repository\Site;
-
- use Lc\SovBundle\Repository\AbstractStore;
-
- class NewsStore extends AbstractStore implements NewsStoreInterface
- {
- protected NewsRepositoryQueryInterface $query;
-
- public function __construct(NewsRepositoryQueryInterface $query)
- {
- $this->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();
- }
- }
|