|
|
@@ -280,6 +280,7 @@ class AdminController extends EasyAdminController |
|
|
|
$allChilds = $form->all(); |
|
|
|
foreach ($allChilds as $child) { |
|
|
|
$statusInterface = false; |
|
|
|
$treeInterface = false; |
|
|
|
$type = $child->getConfig()->getType()->getInnerType(); |
|
|
|
|
|
|
|
if ($type instanceof EntityType) { |
|
|
@@ -294,6 +295,10 @@ class AdminController extends EasyAdminController |
|
|
|
if (in_array('Lc\ShopBundle\Context\StatusInterface', $classImplements)) { |
|
|
|
$statusInterface = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (in_array('Lc\ShopBundle\Context\TreeInterface', $classImplements)) { |
|
|
|
$treeInterface = true; |
|
|
|
} |
|
|
|
$propertyMerchant = 'merchant'; |
|
|
|
if($isFilterMultipleMerchantsInterface) { |
|
|
|
$propertyMerchant .= 's' ; |
|
|
@@ -304,7 +309,7 @@ class AdminController extends EasyAdminController |
|
|
|
'label' => $passedOptions['label'], |
|
|
|
'multiple' => isset($passedOptions['multiple']) ? $passedOptions['multiple'] : false, |
|
|
|
'placeholder' => '--', |
|
|
|
'query_builder' => function (EntityRepository $repo) use ($passedOptions, $propertyMerchant, $statusInterface) { |
|
|
|
'query_builder' => function (EntityRepository $repo) use ($passedOptions, $propertyMerchant, $statusInterface, $treeInterface, $child) { |
|
|
|
$queryBuilder = $repo->createQueryBuilder('e'); |
|
|
|
$propertyMerchant = 'e.' . $propertyMerchant; |
|
|
|
|
|
|
@@ -317,6 +322,9 @@ class AdminController extends EasyAdminController |
|
|
|
if($statusInterface){ |
|
|
|
$queryBuilder->andWhere('e.status >= 0'); |
|
|
|
} |
|
|
|
if($treeInterface && $child->getName() =='parent'){ |
|
|
|
$queryBuilder->andWhere('e.parent is null'); |
|
|
|
} |
|
|
|
$queryBuilder->setParameter(':currentMerchant', $this->getUser()->getMerchant()->getId()); |
|
|
|
|
|
|
|
return $queryBuilder; |