Skip to content

Commit 2574806

Browse files
committed
comment write listener
1 parent 06142c9 commit 2574806

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/EventListener/WriteListener.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ public function onKernelView(GetResponseForControllerResultEvent $event)
6161

6262
$event->setControllerResult($persistResult ?? $controllerResult);
6363

64-
// Comparing the class is necessary because the input might not be readable
64+
// Controller result must be immutable for _api_write_item_iri
65+
// if it's class changed compared to the base class let's avoid calling the IriConverter
66+
// especially that the Output class could be a DTO that's not referencing any route
6567
if (null !== $this->iriConverter && \get_class($controllerResult) === \get_class($event->getControllerResult())) {
6668
$request->attributes->set('_api_write_item_iri', $this->iriConverter->getIriFromItem($controllerResult));
6769
}

0 commit comments

Comments
 (0)