Ver código fonte

Filtre sur marchand via dql_filters

reduction
Fab 4 anos atrás
pai
commit
acd9515fb8
2 arquivos alterados com 34 adições e 0 exclusões
  1. +11
    -0
      ShopBundle/Controller/Admin/AdminController.php
  2. +23
    -0
      ShopBundle/Resources/config/easy_admin/base.yaml

+ 11
- 0
ShopBundle/Controller/Admin/AdminController.php Ver arquivo

@@ -3,6 +3,7 @@
namespace Lc\ShopBundle\Controller\Admin;

use EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use Lc\ShopBundle\Context\MerchantInterface;
use Symfony\Component\Security\Core\Security;

@@ -15,6 +16,16 @@ class AdminController extends EasyAdminController
$this->security = $security;
}

protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)
{
if ($pos = strpos($dqlFilter, 'currentMerchant')) {
$dqlFilter = sprintf(str_replace('currentMerchant', $this->getUser()->getMerchant()->getId(), $dqlFilter));
}

return parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);
}


public function renderTemplate($actionName, $templatePath, array $parameters = [])
{
$parameters = array_merge(

+ 23
- 0
ShopBundle/Resources/config/easy_admin/base.yaml Ver arquivo

@@ -0,0 +1,23 @@
easy_admin:
design:
brand_color: '#1ABC9C'
assets:
favicon: '/assets/img/backend/favicon-pdl.png'
js:
- '/bundles/cksourceckfinder/ckfinder/ckfinder.js'
- '/bundles/lcshop/js/backend/setup-ckfinder.js'
- '/bundles/lcshop/js/backend/custom.js'
css:
- '/bundles/lcshop/css/backend/custom.css'

form_theme:
- '@EasyAdmin/form/bootstrap_4.html.twig'
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
- '@CKSourceCKFinder/Form/fields.html.twig'
list:
max_results: 30

formats:
date: 'd/m/Y'
time: 'h:i A e'
datetime: 'd/m/Y h:i A e'

Carregando…
Cancelar
Salvar