Browse Source

Refactoring repositoryQuery id d'entité

packProduct
Fabien Normand 3 years ago
parent
commit
f86c5b13b3
1 changed files with 11 additions and 13 deletions
  1. +11
    -13
      Repository/Reduction/ReductionCatalogRepositoryQuery.php

+ 11
- 13
Repository/Reduction/ReductionCatalogRepositoryQuery.php View File



public function __construct(ReductionCatalogRepository $repository, PaginatorInterface $paginator) public function __construct(ReductionCatalogRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'reductionCatalog', $paginator);
parent::__construct($repository, 'r', $paginator);
} }


public function joinUsers() public function joinUsers()
$this->isJoinUsers = true; $this->isJoinUsers = true;


return $this return $this
->leftJoin('.users', 'users')
->addSelect('users') ;
->leftJoin('.users', 'pf_users')
->addSelect('pf_users') ;
} }
return $this; return $this;
} }
$this->isJoinGroupUsers = true; $this->isJoinGroupUsers = true;


return $this return $this
->leftJoin('.groupUsers', 'groupusers')
->addSelect('groupusers') ;
->leftJoin('.groupUsers', 'pf_groupusers')
->addSelect('pf_groupusers') ;
} }
return $this; return $this;
} }
$this->isJoinProductFamilies = true; $this->isJoinProductFamilies = true;


return $this return $this
->leftJoin('.productFamilies', 'productFamilies')
->addSelect('productFamilies') ;
->leftJoin('.productFamilies', 'pfs')
->addSelect('pfs') ;
} }
return $this; return $this;
} }
$this->isJoinProductFamily = true; $this->isJoinProductFamily = true;


return $this return $this
->leftJoin('.productFamily', 'productFamily')
->addSelect('productFamily') ;
->leftJoin('.productFamily', 'pf')
->addSelect('pf') ;
} }
return $this; return $this;
} }
$this->isJoinProductCategories = true; $this->isJoinProductCategories = true;


return $this return $this
->leftJoin('.productCategories', 'productCategories')
->addSelect('productCategories') ;
->leftJoin('.productCategories', 'pcs')
->addSelect('pcs') ;
} }
return $this; return $this;
} }
public function filterConditionProductFamilies(array $productFamilies) public function filterConditionProductFamilies(array $productFamilies)
{ {
$this->joinProductFamilies(); $this->joinProductFamilies();
$this->joinProductFamily();


return $this return $this
->andWhere(':productFamilies MEMBER OF .productFamilies OR .productFamilies is empty') ->andWhere(':productFamilies MEMBER OF .productFamilies OR .productFamilies is empty')


public function filterConditionProductFamily(ProductFamilyInterface $productFamily) public function filterConditionProductFamily(ProductFamilyInterface $productFamily)
{ {
$this->joinProductFamilies();
$this->joinProductFamily(); $this->joinProductFamily();


return $this return $this

Loading…
Cancel
Save