|
- <?php
-
- namespace Lc\SovBundle\Repository\Site;
-
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class NewsStore extends AbstractStore implements NewsStoreInterface
- {
-
- protected NewsRepositoryQueryInterface $query;
-
- public function __construct(NewsRepositoryQueryInterface $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- // findLatests
- public function getLatests(int $maxResults = 0, $query = null): array
- {
- $query = $this->createDefaultQuery($query);
-
- $query
- ->filterIsOnline()
- ->orderBy('.date', 'DESC');
-
- if ($maxResults) {
- $query->limit($maxResults);
- }
-
- return $query->find();
- }
- }
|