Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

41 lines
959B

  1. <?php
  2. namespace domain\User\UserProducer;
  3. use domain\User\User\User;
  4. use domain\_\AbstractRepositoryQuery;
  5. class UserProducerRepositoryQuery extends AbstractRepositoryQuery
  6. {
  7. protected UserProducerDefinition $definition;
  8. public function loadDependencies(): void
  9. {
  10. $this->loadDefinition(UserProducerDefinition::class);
  11. }
  12. public function filterByUser(User $user): self
  13. {
  14. $this->andWhere(['id_user' => $user->id]);
  15. return $this;
  16. }
  17. public function filterByActive(bool $active): self
  18. {
  19. $this->andWhere(['active' => $active]);
  20. return $this;
  21. }
  22. public function filterByBookmark(bool $bookmark): self
  23. {
  24. $this->andWhere(['bookmark' => $bookmark]);
  25. return $this;
  26. }
  27. public function filterHasNegativeOrPositiveCredit(): self
  28. {
  29. $this->andWhere('user_producer.credit IS NOT NULL AND user_producer.credit != 0');
  30. return $this;
  31. }
  32. }