選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ReductionCreditStore.php 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Reduction;
  3. use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
  4. use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
  5. use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel;
  6. use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
  7. use Lc\CaracoleBundle\Repository\SectionStoreTrait;
  8. use Lc\SovBundle\Model\User\UserInterface;
  9. use Lc\SovBundle\Repository\AbstractStore;
  10. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  11. class ReductionCreditStore extends AbstractStore
  12. {
  13. use SectionStoreTrait;
  14. protected ReductionCreditRepositoryQuery $query;
  15. public function __construct(
  16. ReductionCreditRepositoryQuery $query
  17. ) {
  18. $this->query = $query;
  19. }
  20. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  21. {
  22. $query->orderBy('id');
  23. return $query;
  24. }
  25. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  26. {
  27. if($this->section) {
  28. $query->filterBySection($this->section);
  29. }
  30. $query->filterIsOnlineAndOffline();
  31. return $query;
  32. }
  33. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  34. {
  35. return $query;
  36. }
  37. // findReductionCreditsByUser
  38. public function getByTypeAndUser(string $type, UserInterface $user, $query = null)
  39. {
  40. $query = $this->createDefaultQuery($query);
  41. $query
  42. ->filterByType($type)
  43. ->filterByUser($user);
  44. return $query->find();
  45. }
  46. // findReductionGiftToUseByUser
  47. public function getReductionGiftToUseByUser(UserInterface $user, $query = null)
  48. {
  49. /// @TODO : à écrire
  50. $query = $this->createDefaultQuery($query);
  51. $query->filterByUser($user);
  52. return $query->find();
  53. }
  54. // findReductionGiftOwnedByUser
  55. public function getReductionGiftOwnedByUser(UserInterface $user, $query = null)
  56. {
  57. /// @TODO : à écrire
  58. $query = $this->createDefaultQuery($query);
  59. $query->filterByUser($user);
  60. return $query->find();
  61. }
  62. // findReductionGiftOwnedActiveByUser
  63. public function getReductionGiftOwnedActiveByUser(UserInterface $user, $query = null)
  64. {
  65. /// @TODO : à écrire
  66. $query = $this->createDefaultQuery($query);
  67. $query->filterByUser($user);
  68. return $query->find();
  69. }
  70. }