From 2574806892fa5694f49327368b41ee3f4d22f0e6 Mon Sep 17 00:00:00 2001 From: soyuka Date: Fri, 2 Nov 2018 10:26:58 +0100 Subject: [PATCH] comment write listener --- src/EventListener/WriteListener.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/EventListener/WriteListener.php b/src/EventListener/WriteListener.php index 520a252d00b..c0933cc2a13 100644 --- a/src/EventListener/WriteListener.php +++ b/src/EventListener/WriteListener.php @@ -61,7 +61,9 @@ public function onKernelView(GetResponseForControllerResultEvent $event) $event->setControllerResult($persistResult ?? $controllerResult); - // Comparing the class is necessary because the input might not be readable + // Controller result must be immutable for _api_write_item_iri + // if it's class changed compared to the base class let's avoid calling the IriConverter + // especially that the Output class could be a DTO that's not referencing any route if (null !== $this->iriConverter && \get_class($controllerResult) === \get_class($event->getControllerResult())) { $request->attributes->set('_api_write_item_iri', $this->iriConverter->getIriFromItem($controllerResult)); }