Browse Source

Test pour réduction requete #624

develop
Fabien Normand 2 years ago
parent
commit
a5f5b4fd08
2 changed files with 9 additions and 0 deletions
  1. +2
    -0
      Repository/Product/ProductCategoryRepositoryQuery.php
  2. +7
    -0
      Repository/Product/ProductFamilyStore.php

+ 2
- 0
Repository/Product/ProductCategoryRepositoryQuery.php View File



return $this return $this
->innerJoin('.productFamilies', 'productFamilies'); ->innerJoin('.productFamilies', 'productFamilies');
//@GONE AWAY avec un addSelect('productFamilies') on gagne 10 requetes

} }


return $this; return $this;

+ 7
- 0
Repository/Product/ProductFamilyStore.php View File

$productFamiliesArray = []; $productFamiliesArray = [];


foreach ($parentCategory->getChildrens() as $i => $category) { foreach ($parentCategory->getChildrens() as $i => $category) {
//Essai d'alternative
// foreach ($category->getProductFamilies() as $productFamily) {
// if($productFamily->getStatus()==1) {
// $productFamiliesArray[$productFamily->getId()] = $productFamily;
// }
// }

$productFamiliesCategory = $this->getByCategory($category); $productFamiliesCategory = $this->getByCategory($category);
foreach ($productFamiliesCategory as $productFamily) { foreach ($productFamiliesCategory as $productFamily) {
$productFamiliesArray[$productFamily->getId()] = $productFamily; $productFamiliesArray[$productFamily->getId()] = $productFamily;

Loading…
Cancel
Save