Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

40 lines
1.3KB

  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  4. use Lc\ShopBundle\Context\OrderShopInterface;
  5. /**
  6. * @method OrderShopInterface|null find($id, $lockMode = null, $lockVersion = null)
  7. * @method OrderShopInterface|null findOneBy(array $criteria, array $orderBy = null)
  8. * @method OrderShopInterface[] findAll()
  9. * @method OrderShopInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  10. */
  11. class OrderShopRepository extends BaseRepository implements DefaultRepositoryInterface
  12. {
  13. public function getInterfaceClass()
  14. {
  15. return OrderShopInterface::class;
  16. }
  17. public function findCurrent($params)
  18. {
  19. $query = $this->createQueryBuilder('e') ;
  20. if(isset($params['user'])) {
  21. $query->andWhere('e.user = :user')->setParameter('user', $params['user']) ;
  22. }
  23. if(isset($params['visitor'])) {
  24. $query->andWhere('e.visitor = :visitor')->setParameter('visitor', $params['visitor']) ;
  25. }
  26. $query->leftJoin('e.orderStatusHistories', 'orderStatusHistories')
  27. ->andWhere('SIZE(e.orderStatusHistories) = 0') ;
  28. return $query->getQuery()->getOneOrNullResult() ;
  29. }
  30. }