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.

46 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Section;
  3. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  4. use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
  5. use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
  6. use Lc\SovBundle\Repository\AbstractStore;
  7. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  8. class SectionStore extends AbstractStore
  9. {
  10. use MerchantStoreTrait;
  11. protected SectionRepositoryQuery $query;
  12. protected OrderShopStore $orderShopStore;
  13. public function __construct(SectionRepositoryQuery $query)
  14. {
  15. $this->query = $query;
  16. }
  17. // getSection
  18. public function getOneByDevAlias(string $devAlias): ?SectionInterface
  19. {
  20. $query = $this->query->create();
  21. $query
  22. ->filterByMerchant($this->merchant)
  23. ->filterByDevAlias($devAlias);
  24. $section = $query->findOne();
  25. if (!$section) {
  26. throw new NotFoundHttpException('La section ' . $devAlias . ' est introuvable');
  27. }
  28. return $section;
  29. }
  30. public function countOpenDays(SectionInterface $section): int
  31. {
  32. // @TODO : à implémenter avec le nouveau système d'ouverture des commandes
  33. }
  34. }