|
- <?php
-
- namespace Lc\PietroBundle\Definition\Field\Workshop;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\PietroBundle\Repository\Workshop\EntryStore;
- use Lc\PietroBundle\Repository\Workshop\WorkshopStore;
- use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
- use Lc\SovBundle\Field\BooleanField;
- use Lc\SovBundle\Translation\TranslatorAdmin;
-
- class EntryFieldDefinition extends AbstractFieldDefinition
- {
- protected WorkshopStore $workshopStore;
-
- public function __construct(TranslatorAdmin $translatorAdmin, WorkshopStore $workshopStore)
- {
- parent::__construct($translatorAdmin);
- $this->workshopStore = $workshopStore;
- }
-
- public function configureIndex(): array
- {
- return [
- 'workshop',
- 'firstname',
- 'lastname',
- 'organization',
- 'city',
- 'email',
- 'phone',
- 'isAnimator'
- ];
- }
-
- public function configureFields(): array
- {
- $workshopArray = $this->workshopStore->get();
-
- return [
- 'workshop' => AssociationField::new('workshop')
- ->setFormTypeOption('choices', $workshopArray),
- 'firstname' => TextField::new('firstname'),
- 'lastname' => TextField::new('lastname'),
- 'organization' => TextField::new('organization'),
- 'city' => TextField::new('city'),
- 'email' => EmailField::new('email'),
- 'phone' => TextField::new('phone'),
- 'isAnimator' => BooleanField::new('isAnimator'),
- ];
- }
- }
|