Skip to content

Commit

Permalink
comment write listener
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Nov 2, 2018
1 parent 06142c9 commit 2574806
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/EventListener/WriteListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 2574806

Please sign in to comment.