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.

54 lines
1.7KB

  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. 'organization',
  26. 'city',
  27. 'email',
  28. 'phone',
  29. 'isAnimator'
  30. ];
  31. }
  32. public function configureFields(): array
  33. {
  34. $workshopArray = $this->workshopStore->get();
  35. return [
  36. 'workshop' => AssociationField::new('workshop')
  37. ->setFormTypeOption('choices', $workshopArray),
  38. 'firstname' => TextField::new('firstname'),
  39. 'lastname' => TextField::new('lastname'),
  40. 'organization' => TextField::new('organization'),
  41. 'city' => TextField::new('city'),
  42. 'email' => EmailField::new('email'),
  43. 'phone' => TextField::new('phone'),
  44. 'isAnimator' => BooleanField::new('isAnimator'),
  45. ];
  46. }
  47. }