You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 line
732B

  1. <?php
  2. namespace Lc\SovBundle\Repository\Site;
  3. use Lc\SovBundle\Repository\AbstractStore;
  4. class NewsStore extends AbstractStore implements NewsStoreInterface
  5. {
  6. protected NewsRepositoryQueryInterface $query;
  7. public function __construct(NewsRepositoryQueryInterface $query)
  8. {
  9. $this->query = $query;
  10. }
  11. //findLatests
  12. public function getLatests(int $maxResults = 0, $query = null): array
  13. {
  14. if (is_null($query)) {
  15. $query = $this->query->create();
  16. }
  17. $query
  18. ->filterIsOnline()
  19. ->orderBy('.date', 'DESC');
  20. if ($maxResults) {
  21. $query
  22. ->limit($maxResults);
  23. }
  24. return $query->find();
  25. }
  26. }