Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iri based on value from persister #2283

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/EventListener/WriteListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public function onKernelView(GetResponseForControllerResultEvent $event)
@trigger_error(sprintf('Returning void from %s::persist() is deprecated since API Platform 2.3 and will not be supported in API Platform 3, an object should always be returned.', DataPersisterInterface::class), E_USER_DEPRECATED);
}

$event->setControllerResult($persistResult ?? $controllerResult);
$controllerResult = $persistResult ?? $controllerResult;
$event->setControllerResult($controllerResult);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has a open discussion here: #2235 (comment) and I believe it breaks a feature (see WriteListenerTest::testOnKernelViewWithControllerResultAndPersistWithImmutableResource, the resource isn't immutable anymore?) ?


if (null !== $this->iriConverter) {
$request->attributes->set('_api_write_item_iri', $this->iriConverter->getIriFromItem($controllerResult));
Expand Down