mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-09 08:14:59 +00:00
WIP: create and edit calendar
This commit is contained in:
@@ -18,6 +18,7 @@ use Chill\CalendarBundle\Entity\Invite;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
@@ -67,22 +68,12 @@ class CalendarType extends AbstractType
|
||||
'expanded' => true,
|
||||
]);
|
||||
|
||||
$builder->add('mainUser', HiddenType::class);
|
||||
$builder->get('mainUser')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
static function (?User $user): int {
|
||||
if (null !== $user) {
|
||||
$res = $user->getId();
|
||||
} else {
|
||||
$res = -1; //TODO cannot be null in any ways...
|
||||
}
|
||||
|
||||
return $res;
|
||||
},
|
||||
function (?int $userId): User {
|
||||
return $this->om->getRepository(user::class)->findOneBy(['id' => (int) $userId]);
|
||||
}
|
||||
));
|
||||
if ($options['data'] instanceof Calendar && $options['data']->getId() === null) {
|
||||
$builder->add('mainUser', PickUserDynamicType::class, [
|
||||
'required' => true,
|
||||
'help' => 'chill_calendar.form.The main user is mandatory. He will organize the appointment.',
|
||||
]);
|
||||
}
|
||||
|
||||
$builder->add('startDate', HiddenType::class);
|
||||
$builder->get('startDate')
|
||||
|
Reference in New Issue
Block a user