Pārlūkot izejas kodu

Champs EntityType filtré sur Merchant pour les FilterMultipleMerchantsInterface

master
Guillaume pirms 4 gadiem
vecāks
revīzija
7164be3a84
1 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. +7
    -2
      ShopBundle/Controller/Admin/AdminController.php

+ 7
- 2
ShopBundle/Controller/Admin/AdminController.php Parādīt failu

@@ -89,7 +89,6 @@ class AdminController extends EasyAdminController

protected function commonQueryFilter($entityClass, $queryBuilder)
{

if (new $entityClass instanceof FilterMultipleMerchantsInterface) {
$queryBuilder->andWhere(':currentMerchant MEMBER OF entity.merchants')
->setParameter(':currentMerchant', $this->getUser()->getMerchant()->getId());
@@ -287,9 +286,15 @@ class AdminController extends EasyAdminController
$passedOptions = $child->getConfig()->getOptions();
$classImplements = class_implements($passedOptions['class']);

if (in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements)) {
$isFilterMerchantInterface = in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements) ;
$isFilterMultipleMerchantsInterface = in_array('Lc\ShopBundle\Context\FilterMultipleMerchantsInterface', $classImplements) ;

if ($isFilterMerchantInterface || $isFilterMultipleMerchantsInterface) {

$propertyMerchant = 'merchant';
if($isFilterMultipleMerchantsInterface) {
$propertyMerchant .= 's' ;
}

$form->add($child->getName(), EntityType::class, array(
'class' => $this->em->getClassMetadata($passedOptions['class'])->getName(),

Notiek ielāde…
Atcelt
Saglabāt