|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Reduction;
-
- use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
- use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
- use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel;
- use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class ReductionCreditStore extends AbstractStore
- {
- use SectionStoreTrait;
-
- protected ReductionCreditRepositoryQuery $query;
-
- public function __construct(
- ReductionCreditRepositoryQuery $query
- ) {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- if($this->section) {
- $query->filterBySection($this->section);
- }
- $query->filterIsOnlineAndOffline();
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- // findReductionCreditsByUser
- public function getByTypeAndUser(string $type, UserInterface $user, $query = null)
- {
- $query = $this->createDefaultQuery($query);
-
- $query
- ->filterByType($type)
- ->filterByUser($user);
-
- return $query->find();
- }
-
- // findReductionGiftToUseByUser
- public function getReductionGiftToUseByUser(UserInterface $user, $query = null)
- {
- /// @TODO : à écrire
- $query = $this->createDefaultQuery($query);
- $query->filterByUser($user);
- return $query->find();
- }
-
- // findReductionGiftOwnedByUser
- public function getReductionGiftOwnedByUser(UserInterface $user, $query = null)
- {
- /// @TODO : à écrire
- $query = $this->createDefaultQuery($query);
- $query->filterByUser($user);
- return $query->find();
- }
-
- // findReductionGiftOwnedActiveByUser
- public function getReductionGiftOwnedActiveByUser(UserInterface $user, $query = null)
- {
- /// @TODO : à écrire
- $query = $this->createDefaultQuery($query);
- $query->filterByUser($user);
- return $query->find();
- }
-
- }
|