query = $query; $this->productFamilySectionPropertySolver = $productFamilySectionPropertySolver; } public function orderByDefault(RepositoryQueryInterface $query) :RepositoryQueryInterface { return $query; } public function filtersDefault($query):RepositoryQueryInterface { $this->addFilterBySectionOptionnal($query); $query->filterIsOnlineAndOffline(); return $query; } public function relationsDefault($query):RepositoryQueryInterface { return $query->joinProductFamily(); } //findProductByAvailabilitiesNegative public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array { $query = $this->createQuery($query); $query->joinProductFamily(); $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->createQuery($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; } }