ソースを参照

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

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