您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

42 行
1.0KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\User;
  3. use App\Entity\Merchant\Merchant;
  4. use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
  5. use Lc\SovBundle\Repository\User\UserRepositoryQuery as SovUserRepositoryQuery;
  6. class UserRepositoryQuery extends SovUserRepositoryQuery
  7. {
  8. use MerchantRepositoryQueryTrait;
  9. protected $isJoinUserMerchants = false;
  10. public function joinUserMerchants(): self
  11. {
  12. if (!$this->isJoinUserMerchants) {
  13. $this->isJoinUserMerchants = true;
  14. return $this
  15. ->innerJoin('.userMerchants', 'um');
  16. }
  17. return $this;
  18. }
  19. public function filterMerchantIsActive(): self
  20. {
  21. $this->joinUserMerchants();
  22. return $this
  23. ->andWhere('um.active = 1');
  24. }
  25. public function filterByMerchant(Merchant $merchant): self
  26. {
  27. $this->joinUserMerchants();
  28. return $this
  29. ->andWhere('um.merchant = :merchant')
  30. ->setParameter('merchant', $merchant);
  31. }
  32. }