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

Fixes #4252 Cascading refresh to lazy loaded assocations #6798

Open
wants to merge 2 commits into
base: 2.12.x
Choose a base branch
from

Conversation

zluiten
Copy link
Contributor

@zluiten zluiten commented Oct 27, 2017

Fixes #4252
Closes #1218

Bug description

Refreshing an entity resets toMany (extra) lazy loaded associations to an empty collection before the refresh operation is cascaded to its underlying associations. Meaning objects that should be refreshed stay unrefreshed in the UoW.

Fix

The fix simply cascades the operation to its associations before refreshing the current entity.

@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch 2 times, most recently from 4d24521 to c7cde75 Compare October 27, 2017 13:23
@zluiten zluiten changed the title Cascading refresh to lazy loaded assocations Fixes #4252 Cascading refresh to lazy loaded assocations Oct 27, 2017
@lcobucci
Copy link
Member

@Netiul please change the destination branch to master and rebase your branch to sync all the changes. That's explained on https://github.com/doctrine/doctrine2/blob/master/CONTRIBUTING.md#we-only-accept-prs--to-master

@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch from 9d21362 to 9d9f684 Compare October 30, 2017 06:22
@zluiten zluiten changed the base branch from 2.5 to master October 30, 2017 06:23
@zluiten
Copy link
Contributor Author

zluiten commented Oct 30, 2017

@lcobucci 👍 Fixed that.

@Majkl578 Majkl578 added the Bug label Dec 8, 2017
@MaSpeng
Copy link

MaSpeng commented Jun 5, 2018

I also ran into this issue with an non updating ManyToMany association and this PR solves my issue.

@lcobucci @Netiul Whats about this PR is there any ongoing progress?

@FrankGiesecke
Copy link

@Netiul Could you resolve the conflicts please?

@lcobucci Please, continue to review this pull request and accept/merge it. Resolving this problem will make many happy developers out there 😉

@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch 2 times, most recently from 9c46970 to 08a1e79 Compare June 8, 2018 22:21
@zluiten
Copy link
Contributor Author

zluiten commented Jun 8, 2018

@FrankGiesecke Rebased on master Rebased on 2.6 after reading updated contribution instructions @lcobucci

@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch from 616a168 to 01f89a8 Compare June 8, 2018 22:48
@zluiten zluiten changed the base branch from master to 2.6 June 8, 2018 22:49
@zluiten zluiten closed this Jun 8, 2018
@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch from f7f7511 to 01f89a8 Compare June 8, 2018 22:55
@zluiten zluiten reopened this Jun 8, 2018
@juliolopeztorres
Copy link

Any news regarding this issue?

I'm facing the same problem as cascade={"refresh"} only refreshes parent entity from oneToMany relation.

I have to manually refresh the Collection as mentioned in this post.

@yapro
Copy link

yapro commented Sep 18, 2021

I have the same problem, cascade={"refresh"} declaration, refresh only parent entity from oneToMany relation.

@angelomelonas
Copy link

angelomelonas commented Oct 8, 2021

I am also facing this issue. This is probably not the best solution, but current workaround I use is:

    private function refreshCollection(Collection $collection): Collection
    {
        foreach ($collection as $item) {
            $this->entityManager->refresh($item);
        }

        return $collection;
    }

@timrasche
Copy link

News on this?

@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch from e94e354 to b4bd3ee Compare April 24, 2022 10:51
@zluiten zluiten changed the base branch from 2.6 to 2.7.x April 24, 2022 10:51
@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch 2 times, most recently from 71879f1 to 61039f3 Compare April 24, 2022 10:58
@zluiten
Copy link
Contributor Author

zluiten commented Apr 24, 2022

Rebased on 2.11.x

@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch from 61039f3 to 3b12f46 Compare April 24, 2022 12:49
@zluiten zluiten changed the base branch from 2.7.x to 2.11.x April 24, 2022 12:49
@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch 3 times, most recently from 91053aa to 52db072 Compare April 24, 2022 12:59
…o toMany associations are not reset to empty collections
@zluiten zluiten force-pushed the fix/4252-cascading-refresh-to-lazy-associations branch from 52db072 to 17bc1ad Compare April 24, 2022 13:08
@derrabus derrabus changed the base branch from 2.11.x to 2.12.x April 24, 2022 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants