|
12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\CreditHistoryInterface;
-
- /**
- * @method CreditHistoryInterface|null find($id, $lockMode = null, $lockVersion = null)
- * @method CreditHistoryInterface|null findOneBy(array $criteria, array $orderBy = null)
- * @method CreditHistoryInterface[] findAll()
- * @method CreditHistoryInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- class CreditHistoryRepository extends BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return CreditHistoryInterface::class;
- }
-
- public function findAllByDateStartEnd($merchant, $dateStart, $dateEnd)
- {
- return $this->createQueryBuilder('e')
- ->innerJoin('e.userMerchant', 'user_merchant')
- ->andWhere('user_merchant.merchant = :merchant')
- ->setParameter(':merchant', $merchant)
- ->andWhere('e.createdAt >= :dateStart')
- ->andWhere('e.createdAt <= :dateEnd')
- ->setParameter(':dateStart', $dateStart)
- ->setParameter(':dateEnd', $dateEnd)
- ->addOrderBy('e.createdAt', 'ASC')
- ->getQuery()->getResult();
- }
-
- public function findAllByUserMerchant($userMerchant)
- {
- return $this->createQueryBuilder('e')
- ->andWhere('e.userMerchant = :userMerchant')
- ->setParameter('userMerchant', $userMerchant)
- ->addOrderBy('e.createdAt', 'DESC')
- ->getQuery()->getResult();
- }
- }
|