fix issue with null comment and set correct variable name in signature

This commit is contained in:
Julien Fastré 2022-05-27 15:58:51 +02:00
parent 5e5a855578
commit f3800ff38f

View File

@ -27,20 +27,20 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma
public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable
{ {
if (null === $data) {
return null;
}
$comment = new PrivateCommentEmbeddable(); $comment = new PrivateCommentEmbeddable();
if (null === $data) {
return $comment;
}
$comment->setCommentForUser($this->security->getUser(), $data); $comment->setCommentForUser($this->security->getUser(), $data);
return $comment; return $comment;
} }
public function normalize($comment, $format = null, array $contect = []): string public function normalize($object, $format = null, array $context = []): string
{ {
return $comment->getCommentForUser($this->security->getUser()); return $object->getCommentForUser($this->security->getUser());
} }
public function supportsDenormalization($data, string $type, ?string $format = null): bool public function supportsDenormalization($data, string $type, ?string $format = null): bool