andWhere('.orderShop = :orderShop') ->setParameter('orderShop', $orderShop); } public function filterByProduct(ProductInterface $product): self { return $this ->andWhere('.product = :product') ->setParameter('product', $product); } public function filterByUser(UserInterface $user): self { $this->joinOrderShop(); return $this ->andWhere('orderShop.user = :user') ->setParameter('user', $user); } public function filterByEmailUser(string $email): self { $this->joinUser(); return $this ->andWhere('user.email LIKE :email') ->setParameter('email', $email); } public function filterByFirstnameUser(string $firstname): self { $this->joinUser(); return $this ->andWhere('user.firstname LIKE :firstname') ->setParameter('firstname', $firstname); } public function filterByLastnameUser(string $lastname): self { $this->joinUser(); return $this ->andWhere('user.lastname LIKE :lastname') ->setParameter('lastname', $lastname); } public function filterBySection(SectionInterface $section): self { $this->joinOrderShop(); return $this->andWhereSection('orderShop', $section); } public function filterByOrderStatus(array $status): self { $this->joinOrderStatus(); return $this ->andWhere('orderStatus.alias IN (:alias)') ->setParameter('alias', $status); } public function selectCount(): self { return $this ->select('count(orderProduct.id) as total'); } public function joinProduct(): self { if (!$this->isJoinProduct) { $this->isJoinProduct = true; return $this ->leftJoin('.product', 'product'); } return $this; } public function joinProductFamily(): self { $this->joinProduct(); if (!$this->isJoinProductFamily) { $this->isJoinProductFamily = true; return $this ->leftJoin('product.productFamily', 'productFamily'); } return $this; } public function joinOrderShop(): self { if (!$this->isJoinOrderShop) { $this->isJoinOrderShop = true; return $this ->leftJoin('.orderShop', 'orderShop'); } return $this; } public function joinUser(): self { if (!$this->isJoinOrderShop) { $this->joinOrderShop(); } if (!$this->isJoinUser) { $this->isJoinUser = true; return $this ->leftJoin('orderShop.user', 'user'); } return $this; } public function joinSection(): self { if (!$this->isJoinSection) { $this->isJoinSection = true; return $this ->leftJoin('orderShop.section', 'section'); } return $this; } public function joinOrderStatus(): self { $this->joinOrderShop(); if (!$this->isJoinOrderStatus) { $this->isJoinOrderStatus = true; return $this ->leftJoin('orderShop.orderStatus', 'orderStatus'); } return $this; } public function filterByMerchant(MerchantInterface $merchant) { $this->joinOrderShop(); $this->joinSection(); return $this->andWhere('section.merchant = :merchant') ->setParameter('merchant', $merchant); } }