ソースを参照

Champs EntityType filtré sur Merchant pour les FilterMultipleMerchantsInterface

master
Guillaume 4年前
コミット
7164be3a84
1個のファイルの変更7行の追加2行の削除
  1. +7
    -2
      ShopBundle/Controller/Admin/AdminController.php

+ 7
- 2
ShopBundle/Controller/Admin/AdminController.php ファイルの表示

@@ -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(),

読み込み中…
キャンセル
保存