No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

UserMerchantFieldDefinition.php 1.8KB

hace 3 años
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace Lc\CaracoleBundle\Definition\Field\User;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  6. use Lc\CaracoleBundle\Context\MerchantContextTrait;
  7. use Lc\CaracoleBundle\Field\AssociationField;
  8. use Lc\CaracoleBundle\Field\Filter\User\UserMerchantEmailFilter;
  9. use Lc\CaracoleBundle\Field\Filter\User\UserMerchantFirstnameFilter;
  10. use Lc\CaracoleBundle\Field\Filter\User\UserMerchantLastnameFilter;
  11. use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
  12. class UserMerchantFieldDefinition extends AbstractFieldDefinition
  13. {
  14. use MerchantContextTrait;
  15. public function configureIndex(): array
  16. {
  17. return [
  18. 'id',
  19. 'lastname',
  20. 'firstname',
  21. 'email',
  22. 'credit',
  23. ];
  24. }
  25. public function configureForm(): array
  26. {
  27. return [
  28. 'user',
  29. ];
  30. }
  31. public function configureFields(): array
  32. {
  33. return [
  34. 'id' => IntegerField::new('id')->onlyOnIndex()->setSortable(true),
  35. 'lastname' => TextField::new('user.lastname')
  36. ->setCustomOption('filter_fqcn', UserMerchantLastnameFilter::class),
  37. 'firstname' => TextField::new('user.firstname')
  38. ->setCustomOption('filter_fqcn', UserMerchantFirstnameFilter::class),
  39. 'email' => TextField::new('user.email')
  40. ->setCustomOption('filter_fqcn', UserMerchantEmailFilter::class),
  41. 'credit' => NumberField::new('credit')->setSortable(true)
  42. ->setTemplatePath('@LcSov/adminlte/crud/field/amount.html.twig')
  43. ->setCustomOption('appendHtml', '&euro;'),
  44. 'user' => AssociationField::new('user'),
  45. ];
  46. }
  47. }