|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?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();
- }
- }
|