Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

48 rindas
1.2KB

  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. }