groupUserStore = $groupUserStore; $this->newsletterStore = $newsletterStore; } public function configureForm(): array { return [ 'gender', 'lastname', 'firstname', 'email', 'phone', 'birthdate', 'groupUsers', 'isSaleAlwaysOpen', 'newsletters' ]; } public function configureFields(): array { $groupUsers = $this->groupUserStore->setMerchant($this->merchant)->getAll(); $newsletters = $this->newsletterStore->getAll(); return array_merge(parent::configureFields(),[ 'isSaleAlwaysOpen' => BooleanField::new('isSaleAlwaysOpen'), 'newsletters' => AssociationField::new('newsletters') ->setFormTypeOption('choices', $newsletters) ->setFormTypeOption('choice_label', function ($choice) { return $choice->getTitle(). '['.$choice->getSection()->getMerchant().']'; }) ->setSortable(true), 'groupUsers' => AssociationField::new('groupUsers') ->setFormTypeOption('choices', $groupUsers) ->setFormTypeOption('choice_label', function ($choice) { return $choice->getTitle(). '['.$choice->getMerchant().']'; }) ->setSortable(true) ]); } }