From bfea0dba52bb1f586597cd30b3ec418cb3d5694d Mon Sep 17 00:00:00 2001 From: Simone Bernini Date: Fri, 23 Aug 2024 15:26:12 +0200 Subject: [PATCH] fixed callback transformers types --- src/Block/GalleryBlockService.php | 4 ++-- src/Block/MediaBlockService.php | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Block/GalleryBlockService.php b/src/Block/GalleryBlockService.php index ca003ccbb..1afaf7098 100644 --- a/src/Block/GalleryBlockService.php +++ b/src/Block/GalleryBlockService.php @@ -212,8 +212,8 @@ private function getGalleryBuilder(AdminFormMapper $form): FormBuilderInterface ]); $formBuilder->addModelTransformer(new CallbackTransformer( - static fn (?MediaInterface $value): ?MediaInterface => $value, - static fn (?MediaInterface $value) => $value instanceof MediaInterface ? $value->getId() : $value + static fn (?GalleryInterface $value): ?GalleryInterface => $value, + static fn (?GalleryInterface $value) => $value instanceof GalleryInterface ? $value->getId() : $value )); return $formBuilder; diff --git a/src/Block/MediaBlockService.php b/src/Block/MediaBlockService.php index 17e7e47a1..da4b37c9d 100644 --- a/src/Block/MediaBlockService.php +++ b/src/Block/MediaBlockService.php @@ -25,7 +25,6 @@ use Sonata\BlockBundle\Model\BlockInterface; use Sonata\Form\Type\ImmutableArrayType; use Sonata\Form\Validator\ErrorElement; -use Sonata\MediaBundle\Model\GalleryInterface; use Sonata\MediaBundle\Model\MediaInterface; use Sonata\MediaBundle\Model\MediaManagerInterface; use Sonata\MediaBundle\Provider\Pool; @@ -224,8 +223,8 @@ private function getMediaBuilder(AdminFormMapper $form): FormBuilderInterface ]); $formBuilder->addModelTransformer(new CallbackTransformer( - static fn (?GalleryInterface $value): ?GalleryInterface => $value, - static fn (?GalleryInterface $value) => $value instanceof GalleryInterface ? $value->getId() : $value + static fn (?MediaInterface $value): ?MediaInterface => $value, + static fn (?MediaInterface $value) => $value instanceof MediaInterface ? $value->getId() : $value )); return $formBuilder;