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.

DistributionStore.php 1.2KB

пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Distribution;
  3. use App\Entity\Distribution\Distribution;
  4. use Lc\CaracoleBundle\Repository\AbstractStore;;
  5. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  6. class DistributionStore extends AbstractStore
  7. {
  8. protected DistributionRepositoryQuery $query;
  9. public function __construct(DistributionRepositoryQuery $query)
  10. {
  11. $this->query = $query;
  12. }
  13. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  14. {
  15. $query->orderBy('id');
  16. return $query;
  17. }
  18. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  19. {
  20. return $query;
  21. }
  22. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  23. {
  24. return $query;
  25. }
  26. public function getOneByCycleNumberYearAndCycleType(
  27. int $cycleNumber,
  28. int $year,
  29. string $cycleType
  30. ): ?Distribution {
  31. $query = $this->createQuery();
  32. $query->filterByCycleNumber($cycleNumber);
  33. $query->filterByYear($year);
  34. $query->filterByCycleType($cycleType);
  35. return $query->findOne();
  36. }
  37. }