Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

46 lines
1.0KB

  1. <?php
  2. namespace domain\Feature\Feature;
  3. use domain\_\AbstractRepository;
  4. class FeatureRepository extends AbstractRepository
  5. {
  6. protected FeatureRepositoryQuery $query;
  7. public function loadDependencies(): void
  8. {
  9. $this->loadQuery(FeatureRepositoryQuery::class);
  10. }
  11. public function getDefaultOptionsSearch(): array
  12. {
  13. return [
  14. self::WITH => ['featureProducers'],
  15. self::JOIN_WITH => [],
  16. self::ORDER_BY => 'position ASC',
  17. self::ATTRIBUTE_ID_PRODUCER => ''
  18. ];
  19. }
  20. public function findOneFeatureById(int $id): ?Feature
  21. {
  22. return $this->createQuery()
  23. ->filterById($id)
  24. ->findOne();
  25. }
  26. public function findOneFeatureByAlias(string $alias): ?Feature
  27. {
  28. return $this->createQuery()
  29. ->filterByAlias($alias)
  30. ->findOne();
  31. }
  32. public function findPaidFeatures(): array
  33. {
  34. return $this->createQuery()
  35. ->filterIsPaidFeature()
  36. ->find();
  37. }
  38. }