mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 22:35:01 +00:00
rdv: fullcalendar: save calendarRange id as an extended prop in the calendar entity
This commit is contained in:
@@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\CalendarBundle\Entity\CalendarRange;
|
||||
use Chill\CalendarBundle\Entity\CancelReason;
|
||||
use Chill\CalendarBundle\Entity\Invite;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
@@ -145,6 +146,24 @@ class CalendarType extends AbstractType
|
||||
))
|
||||
;
|
||||
|
||||
$builder->add('calendarRange', HiddenType::class);
|
||||
$builder->get('calendarRange')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (?CalendarRange $calendarRange): int {
|
||||
if (NULL !== $calendarRange) {
|
||||
$res = $calendarRange->getId();
|
||||
} else {
|
||||
$res = -1;
|
||||
}
|
||||
return $res;
|
||||
},
|
||||
function (?string $calendarRangeId): CalendarRange {
|
||||
return $this->om->getRepository(CalendarRange::class)->findOneBy(['id' => (int) $calendarRangeId]);
|
||||
}
|
||||
))
|
||||
;
|
||||
|
||||
|
||||
// $builder->add('invites', HiddenType::class);
|
||||
// $builder->get('invites')
|
||||
// ->addModelTransformer(new CallbackTransformer(
|
||||
|
Reference in New Issue
Block a user