Você não pode selecionar mais de 25 tópicos
Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Product;
-
- use App\Solver\Product\ProductFamilySectionPropertySolver;
- use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\CaracoleBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class ProductStore extends AbstractStore
- {
- use SectionStoreTrait;
- use MerchantStoreTrait;
-
- protected ProductRepositoryQuery $query;
- protected ProductFamilySectionPropertySolver $productFamilySectionPropertySolver;
-
- public function __construct(ProductRepositoryQuery $query, ProductFamilySectionPropertySolver $productFamilySectionPropertySolver)
- {
- $this->query = $query;
- $this->productFamilySectionPropertySolver = $productFamilySectionPropertySolver;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query) :RepositoryQueryInterface
- {
- return $query;
- }
-
- public function filtersDefault($query):RepositoryQueryInterface
- {
- $this->addFilterBySectionOptionnal($query);
- $this->addFilterByMerchantViaSectionOptionnal($query);
- $query->filterIsOnlineAndOffline();
-
- return $query;
- }
-
- public function relationsDefault($query):RepositoryQueryInterface
- {
- return $query->joinProductFamily();
- }
-
- //findProductByAvailabilitiesNegative
- public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array
- {
- $query = $this->createDefaultQuery($query);
-
- $query->filterIsOnline();
- $query->filterAvailableQuantityNegative();
- $query->groupBy('productFamily.id');
- $productListAvailableQuantityNegative = $query->find();
-
- foreach ($productListAvailableQuantityNegative as $i=>$product) {
- if(!$this->productFamilySectionPropertySolver->useBehaviorStockAvailableQuantity($product->getProductfamily())){
- unset($productListAvailableQuantityNegative[$i]);
- }
- }
- return $productListAvailableQuantityNegative;
- }
-
- public function getByAvailabilitiesSupplierNegative(ProductRepositoryQuery $query = null): array
- {
- $query = $this->createDefaultQuery($query);
- $query->joinProductFamily();
- $query->filterIsOnline();
- $query->filterAvailableQuantitySupplierNegative();
- $query->groupBy('productFamily.id');
- $productListAvailableQuantityNegative = $query->find();
-
- foreach ($productListAvailableQuantityNegative as $i=>$product) {
- if(!$this->productFamilySectionPropertySolver->useBehaviorStockAvailableQuantitySupplier($product->getProductfamily())){
- unset($productListAvailableQuantityNegative[$i]);
- }
- }
- return $productListAvailableQuantityNegative;
- }
-
-
- }
|