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.

52 line
1.6KB

  1. <?php
  2. namespace Lc\PietroBundle\Definition\Field\Workshop;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  6. use Lc\PietroBundle\Repository\Workshop\EntryStore;
  7. use Lc\PietroBundle\Repository\Workshop\WorkshopStore;
  8. use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
  9. use Lc\SovBundle\Field\BooleanField;
  10. use Lc\SovBundle\Translation\TranslatorAdmin;
  11. class EntryFieldDefinition extends AbstractFieldDefinition
  12. {
  13. protected WorkshopStore $workshopStore;
  14. public function __construct(TranslatorAdmin $translatorAdmin, WorkshopStore $workshopStore)
  15. {
  16. parent::__construct($translatorAdmin);
  17. $this->workshopStore = $workshopStore;
  18. }
  19. public function configureIndex(): array
  20. {
  21. return [
  22. 'workshop',
  23. 'firstname',
  24. 'lastname',
  25. 'city',
  26. 'email',
  27. 'phone',
  28. 'isAnimator'
  29. ];
  30. }
  31. public function configureFields(): array
  32. {
  33. $workshopArray = $this->workshopStore->get();
  34. return [
  35. 'workshop' => AssociationField::new('workshop')
  36. ->setFormTypeOption('choices', $workshopArray),
  37. 'firstname' => TextField::new('firstname'),
  38. 'lastname' => TextField::new('lastname'),
  39. 'city' => TextField::new('city'),
  40. 'email' => EmailField::new('email'),
  41. 'phone' => TextField::new('phone'),
  42. 'isAnimator' => BooleanField::new('isAnimator'),
  43. ];
  44. }
  45. }