mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-18 12:44:59 +00:00
work on create calendar
This commit is contained in:
@@ -70,6 +70,7 @@ class CalendarType extends AbstractType
|
||||
|
||||
if ($options['data'] instanceof Calendar && $options['data']->getId() === null) {
|
||||
$builder->add('mainUser', PickUserDynamicType::class, [
|
||||
'multiple' => false,
|
||||
'required' => true,
|
||||
'help' => 'chill_calendar.form.The main user is mandatory. He will organize the appointment.',
|
||||
]);
|
||||
@@ -192,26 +193,6 @@ class CalendarType extends AbstractType
|
||||
return $this->om->getRepository(Location::class)->findOneBy(['id' => (int) $id]);
|
||||
}
|
||||
));
|
||||
|
||||
$builder->add('invites', HiddenType::class);
|
||||
$builder->get('invites')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
static function (iterable $usersAsIterable): string {
|
||||
$userIds = [];
|
||||
|
||||
foreach ($usersAsIterable as $value) {
|
||||
$userIds[] = $value->getId();
|
||||
}
|
||||
|
||||
return implode(',', $userIds);
|
||||
},
|
||||
function (?string $usersAsString): array {
|
||||
return array_map(
|
||||
fn (string $id): ?Invite => $this->om->getRepository(Invite::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $usersAsString)
|
||||
);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
Reference in New Issue
Block a user