-
Notifications
You must be signed in to change notification settings - Fork 206
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
Fix EZP-25366: relation fields aren't copied correctly #1558
Conversation
Ping @joaoinacio & @andrerom |
@@ -1586,6 +1586,9 @@ public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $dest | |||
); | |||
} | |||
|
|||
$relations = $locationIdToContentIdMapping = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
short notation? :)
48519a5
to
7d53274
Compare
Looks good, as for |
Unfortunately, |
May be wrong here as I didn't dig deep into the tests, but it seems this could have the same problem as a recent issue, whereby relations from old versions are taken into account (kept in object_link) when they shouldn't. Example:
Correct content relations would be B , C but not A. |
Also, I'm left wondering if this solution be helpful in the context of https://jira.ez.no/browse/EZP-24540 ? |
This bugfix doesn't really intend to fix this, to be frank. |
7d53274
to
4b97d3a
Compare
Updated approach, review ping @bdunogier @Plopix @crevillo |
tested with a command like this: // subtree
$repo->getLocationService()->copySubtree($source->location, $dest->location);
// simple
$locationStruct = $repo->getLocationService()->newLocationCreateStruct($dest->location->id);
$repo->getContentService()->copyContent($source->content->contentInfo, $locationStruct); And also tested in the original context of the explained bug in the issue. ping @andrerom @bdunogier => Nice job guys ! It works! |
Great job @andrerom. +1 |
…ne\DBAL\Connection
Implment the logic in Persistnece layer to be able to hande for both content and subtree copy.
a24eee9
to
4f9d268
Compare
Thanks, but did actually miss adding 1 test in RelationSearchMultivaluedBaseIntegrationTest, which given it was a duplicate of RelationSearchBaseIntegrationTest made me change them into 1 trait during last rebase. So hopefully even better now :) Side: Failure is because of behat, issues with some other unrelated merges afaik, should be checked before next sub release. |
Yes, this is one part of tests where we have a big debt to pay. |
+1 |
Shouldn't you squash the integration tests with the bugfix ? We do backport the tests as well, unless I am mistaken. |
I'll do that on the back port, in case further back ports, thanks for reviewing :) |
…n_field Fix EZP-25366: relation fields aren't copied correctly
When copying content with relation fields, relations on the copy were not properly registered. This is fixed by applying the same logic used in createContent() and updateContent(): relations inside fields are recorded during copy, and registered using the persistence later at the end.
TODO