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.

OpeningStore.php 1.1KB

3 年之前
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Section;
  3. use Lc\CaracoleBundle\Repository\SectionStoreTrait;
  4. use Lc\CaracoleBundle\Repository\AbstractStore;
  5. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  6. class OpeningStore extends AbstractStore
  7. {
  8. use SectionStoreTrait;
  9. protected OpeningRepositoryQuery $query;
  10. public function __construct(OpeningRepositoryQuery $query)
  11. {
  12. $this->query = $query;
  13. }
  14. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  15. {
  16. $query->orderBy('day');
  17. return $query;
  18. }
  19. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  20. {
  21. $this->addFilterBySectionOptionnal($query);
  22. return $query;
  23. }
  24. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  25. {
  26. return $query;
  27. }
  28. public function getOneToday($query = null)
  29. {
  30. $query = $this->createDefaultQuery($query);
  31. $query->filterByToday();
  32. return $query->findOne();
  33. }
  34. }