You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Field\Filter\User;
  3. use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto;
  4. use Lc\SovBundle\Field\Filter\AssociationFilter;
  5. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  6. use Symfony\Component\Form\Extension\Core\Type\TextType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. /**
  9. * @author La clic ! <contact@laclic.fr>
  10. */
  11. class UserMerchantEmailFilter extends AssociationFilter
  12. {
  13. public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array())
  14. {
  15. $builder->add(
  16. $this->getFieldPropertySnake($fieldDto->getProperty()),
  17. TextType::class,
  18. array(
  19. 'required' => false,
  20. 'attr' => array(
  21. 'class' => ' input-sm autocomplete-disabled',
  22. 'form' => 'filters-form',
  23. ),
  24. )
  25. );
  26. }
  27. public function applyFilter(RepositoryQueryInterface $repositoryQuery, FieldDto $fieldDto, $filteredValue = null)
  28. {
  29. if ($filteredValue !== null) {
  30. $repositoryQuery->filterByEmail('%'.$filteredValue.'%');
  31. }
  32. }
  33. }