Quellcode durchsuchen

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

develop
Fab vor 3 Jahren
Ursprung
Commit
f31a8367ca
2 geänderte Dateien mit 22 neuen und 8 gelöschten Zeilen
  1. +20
    -8
      ShopBundle/Controller/Backend/AdminController.php
  2. +2
    -0
      ShopBundle/Services/Utils.php

+ 20
- 8
ShopBundle/Controller/Backend/AdminController.php Datei anzeigen

@@ -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 Datei anzeigen

@@ -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'])
],
]);

Laden…
Abbrechen
Speichern