You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Order;
-
- use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
- use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
- use Lc\CaracoleBundle\Model\Product\ProductInterface;
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\CaracoleBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class OrderProductStore extends AbstractStore
- {
- use SectionStoreTrait;
-
- protected OrderProductRepositoryQuery $query;
-
- public function __construct(OrderProductRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $this->addFilterBySectionOptionnal($query);
-
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- // findOrderProductsInCartsByProduct
- public function getInCartsByProduct(ProductInterface $product, $query = null): array
- {
- $query = $this->createDefaultQuery($query);
- $query->filterByProduct($product);
- $query->filterByOrderStatus(OrderStatusModel::$statusAliasAsCart);
- return $query->find();
- }
- }
|