Преглед на файлове

[Backend] Découpage et recherche sur champ user name/firstname/email

develop
Fab преди 3 години
родител
ревизия
f31a8367ca
променени са 2 файла, в които са добавени 22 реда и са изтрити 8 реда
  1. +20
    -8
      ShopBundle/Controller/Backend/AdminController.php
  2. +2
    -0
      ShopBundle/Services/Utils.php

+ 20
- 8
ShopBundle/Controller/Backend/AdminController.php Целия файл

@@ -230,16 +230,28 @@ class AdminController extends EasyAdminController
$filter = $this->getListFilterParam($field['property']);
//$filter = $this->filtersForm->get($field['property'])->getData();
if ($filter !== null) {
if ($field['type_options']['multiple']) {
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . '');
} else {
$queryBuilder->andWhere('entity.' . $field['property'] . ' = :' . $field['property'] . '');
}
if ($filter instanceof TreeInterface && $filter->getParent() == null) {
$queryBuilder->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray()));
} else {

//TODO Faut généraliser avec TreeInterface, ça ne doit pas être ici
if($field['property'] == 'productCategories') {

$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'].' OR product_categories.parent = :' . $field['property']);
$queryBuilder->setParameter($field['property'], $filter);
}
else {
if ($field['type_options']['multiple']) {
$queryBuilder->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . '');
}
else {
$queryBuilder->andWhere('entity.' . $field['property'] . ' = :' . $field['property'] . '');
}

if ($filter instanceof TreeInterface && $filter->getParent() == null) {
$queryBuilder->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray()));
}
else {
$queryBuilder->setParameter($field['property'], $filter);
}
}
}
break;
case 'datetime':

+ 2
- 0
ShopBundle/Services/Utils.php Целия файл

@@ -30,6 +30,7 @@ use Symfony\Component\HttpClient\HttplugClient;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Validator\Constraints\EqualTo;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Contracts\Translation\TranslatorInterface;

class Utils
@@ -554,6 +555,7 @@ class Utils
'class' => 'special-field'
],
'constraints' => [
new NotNull(),
new EqualTo(['value' => $this->parameterBag->get('app.captcha_value'), 'message' => 'Valeur incorrecte'])
],
]);

Loading…
Отказ
Запис