|
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\OrderShopInterface;
-
- /**
- * @method OrderShopInterface|null find($id, $lockMode = null, $lockVersion = null)
- * @method OrderShopInterface|null findOneBy(array $criteria, array $orderBy = null)
- * @method OrderShopInterface[] findAll()
- * @method OrderShopInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- class OrderShopRepository extends BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return OrderShopInterface::class;
- }
-
- public function findCurrent($params)
- {
- $query = $this->createQueryBuilder('e') ;
-
- if(isset($params['user'])) {
- $query->andWhere('e.user = :user')->setParameter('user', $params['user']) ;
- }
-
- if(isset($params['visitor'])) {
- $query->andWhere('e.visitor = :visitor')->setParameter('visitor', $params['visitor']) ;
- }
-
- $query->leftJoin('e.orderStatusHistories', 'orderStatusHistories')
- ->andWhere('SIZE(e.orderStatusHistories) = 0') ;
-
- return $query->getQuery()->getOneOrNullResult() ;
- }
-
- }
|