Skip to content

fix(state): object-mapper reuse related entity #7300

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soyuka
Copy link
Member

@soyuka soyuka commented Jul 18, 2025

Q A
Branch? main
License MIT

Fixes an issue where we keep fetched relations so that we don't create new entities instead of persisting the existing one. Check the test and the issue at symfony/symfony#61119.

This needs symfony/symfony#61145 to work.


public function map(object $source, object|string|null $target = null): object
{
if (isset($this->objectMap[$source])) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want to check if a target has not been given explicitly by the user before overriding it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants