|
|
|
|
|
|
|
|
if ($filter !== null) { |
|
|
if ($filter !== null) { |
|
|
if ($this->utils->hasFilterAssociation($field['initProperty'])) { |
|
|
if ($this->utils->hasFilterAssociation($field['initProperty'])) { |
|
|
$aliasRelation = $this->utils->getFilterAssociationAlias($field['initProperty']); |
|
|
$aliasRelation = $this->utils->getFilterAssociationAlias($field['initProperty']); |
|
|
if(array_search($aliasRelation, $queryBuilder->getAllAliases())===false){ |
|
|
|
|
|
$queryBuilder->innerJoin('entity.'.$aliasRelation, $aliasRelation); |
|
|
|
|
|
|
|
|
if (array_search($aliasRelation, $queryBuilder->getAllAliases()) === false) { |
|
|
|
|
|
$queryBuilder->innerJoin('entity.' . $aliasRelation, $aliasRelation); |
|
|
} |
|
|
} |
|
|
$queryBuilder->andWhere($field['initProperty'] . ' LIKE :' . $field['property'] . ''); |
|
|
$queryBuilder->andWhere($field['initProperty'] . ' LIKE :' . $field['property'] . ''); |
|
|
$queryBuilder->setParameter($field['property'], '%' . $filter . '%'); |
|
|
$queryBuilder->setParameter($field['property'], '%' . $filter . '%'); |
|
|
|
|
|
|
|
|
if ($filter !== null) { |
|
|
if ($filter !== null) { |
|
|
|
|
|
|
|
|
//TODO Faut généraliser avec TreeInterface, ça ne doit pas être ici |
|
|
//TODO Faut généraliser avec TreeInterface, ça ne doit pas être ici |
|
|
if($field['property'] == 'productCategories') { |
|
|
|
|
|
|
|
|
if ($field['property'] == 'productCategories') { |
|
|
|
|
|
|
|
|
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'].' OR product_categories.parent = :' . $field['property']); |
|
|
|
|
|
|
|
|
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . ' OR product_categories.parent = :' . $field['property']); |
|
|
$queryBuilder->setParameter($field['property'], $filter); |
|
|
$queryBuilder->setParameter($field['property'], $filter); |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
if ($field['type_options']['multiple']) { |
|
|
if ($field['type_options']['multiple']) { |
|
|
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . ''); |
|
|
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . ''); |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
$queryBuilder->andWhere('entity.' . $field['property'] . ' = :' . $field['property'] . ''); |
|
|
$queryBuilder->andWhere('entity.' . $field['property'] . ' = :' . $field['property'] . ''); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($filter instanceof TreeInterface && $filter->getParent() == null) { |
|
|
if ($filter instanceof TreeInterface && $filter->getParent() == null) { |
|
|
$queryBuilder->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray())); |
|
|
$queryBuilder->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray())); |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
$queryBuilder->setParameter($field['property'], $filter); |
|
|
$queryBuilder->setParameter($field['property'], $filter); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$isFilterMerchantInterface = in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements); |
|
|
$isFilterMerchantInterface = in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements); |
|
|
$isFilterMultipleMerchantsInterface = in_array('Lc\ShopBundle\Context\FilterMultipleMerchantsInterface', $classImplements); |
|
|
$isFilterMultipleMerchantsInterface = in_array('Lc\ShopBundle\Context\FilterMultipleMerchantsInterface', $classImplements); |
|
|
|
|
|
|
|
|
if ($isFilterMerchantInterface || $isFilterMultipleMerchantsInterface) { |
|
|
|
|
|
|
|
|
if (($isFilterMerchantInterface || $isFilterMultipleMerchantsInterface) && (!isset($passedOptions['merchant_filter']) || $passedOptions['merchant_filter'] === true)) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (in_array('Lc\ShopBundle\Context\StatusInterface', $classImplements)) { |
|
|
if (in_array('Lc\ShopBundle\Context\StatusInterface', $classImplements)) { |
|
|
$statusInterface = true; |
|
|
$statusInterface = true; |