|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Credit;
-
- use App\Entity\User\UserMerchant;
- use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
- use Lc\SovBundle\Repository\AbstractStore;
- use DateTime;
-
- class CreditHistoryStore extends AbstractStore
- {
- use MerchantStoreTrait;
-
- protected CreditHistoryRepositoryQuery $query;
-
- public function __construct(CreditHistoryRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- //findAllByDateStartEnd
- public function getByDateStartEnd(DateTime $dateStart, DateTime $dateEnd): array
- {
- $query = $this->query->create();
-
- $query
- ->filterByJoinUserMerchant($this->merchant)
- ->filterByDateStart($dateStart)
- ->filterByDateEnd($dateEnd)
- ->orderBy('.createdAt');
-
- return $query->find();
- }
-
- //findAllByUserMerchant
- public function getByUserMerchant(UserMerchant $userMerchant): array
- {
- $query = $this->query->create();
-
- $query
- ->filterByUserMerchant($userMerchant)
- ->orderBy('.createdAt', 'DESC');
-
- return $query->find();
- }
- }
|