|
- <?php
-
- namespace Lc\CaracoleBundle\Field\Filter\User;
-
- use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto;
- use Lc\SovBundle\Field\Filter\AssociationFilter;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
- use Symfony\Component\Form\Extension\Core\Type\TextType;
- use Symfony\Component\Form\FormBuilderInterface;
-
- /**
- * @author La clic ! <contact@laclic.fr>
- */
- class UserMerchantEmailFilter extends AssociationFilter
- {
- public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array())
- {
- $builder->add(
- $this->getFieldPropertySnake($fieldDto->getProperty()),
- TextType::class,
- array(
- 'required' => false,
- 'attr' => array(
- 'class' => ' input-sm autocomplete-disabled',
- 'form' => 'filters-form',
- ),
- )
- );
- }
-
- public function applyFilter(RepositoryQueryInterface $repositoryQuery, FieldDto $fieldDto, $filteredValue = null)
- {
- if ($filteredValue !== null) {
- $repositoryQuery->filterByEmail('%'.$filteredValue.'%');
- }
- }
-
- }
|