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

Ensure "cascade" mapping is set for ResolveTargetDocumentListener #888

Closed
wants to merge 1 commit into from

Conversation

jaymecd
Copy link
Contributor

@jaymecd jaymecd commented May 26, 2014

... due 'cascade' was not accessible in ResolveTargetDocumentListener while remapping and resolved target document does not inherit original cascade rules.

@malarzm
Copy link
Member

malarzm commented May 27, 2014

Few tests are failing now and are relevant to your PR

@jaymecd
Copy link
Contributor Author

jaymecd commented May 27, 2014

Tnx, my bad, was too fast to create PR, fix it soon

@jaymecd
Copy link
Contributor Author

jaymecd commented May 27, 2014

Still having 1 error (looks like unrelared):

1) Doctrine\ODM\MongoDB\Tests\Functional\ReferencesTest::testReferenceOneWithNullId
Failed asserting that exception of type "Doctrine\Common\Proxy\Exception\OutOfBoundsException" matches expected exception "\Doctrine\ODM\MongoDB\DocumentNotFoundException". 
Message was: "Missing value for primary key profileId on Documents\Profile"

Any idea how to fix?

@jaymecd
Copy link
Contributor Author

jaymecd commented May 27, 2014

Btw, this error appears on master as well.

@jaymecd
Copy link
Contributor Author

jaymecd commented May 27, 2014

fyi @jmikola

@jaymecd
Copy link
Contributor Author

jaymecd commented May 28, 2014

Blocked by #890

@jmikola
Copy link
Member

jmikola commented Jun 5, 2014

@jaymecd: #890 is fixed by #900. See the latter PR for more info.

Feel free to rebase and ping me to review.

due 'cascade' was not accessible in ResolveTargetDocumentListener while remapping and resolved target document does not inherit original cascade rules.
@jaymecd
Copy link
Contributor Author

jaymecd commented Jun 5, 2014

@jmikola, done

@jmikola jmikola added this to the 1.0.0-BETA11 milestone Jun 5, 2014
@jmikola
Copy link
Member

jmikola commented Jun 5, 2014

I realize this makes the ODM handling in line with ORM (see: here), but can you elaborate on the bug that this fixes? From the test changes, it looks like the referenced document associations never received cascade info.

$mapping['isCascadeRefresh'] = in_array('refresh', $cascades);
$mapping['isCascadeMerge'] = in_array('merge', $cascades);
$mapping['isCascadeDetach'] = in_array('detach', $cascades);
$mapping['isCascadeCallbacks'] = in_array('callbacks', $cascades);
Copy link
Member

Choose a reason for hiding this comment

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

Other than expectations in tests, I don't see isCascadeCallbacks used anywhere in ODM. ORM has no such cascade, either. @jwage: is this obsolete and a candidate for removal?

@jaymecd
Copy link
Contributor Author

jaymecd commented Jun 6, 2014

@jmikola, yes similar processing as ORM has, but I'm afraid that didn't get you correctly what u want me to do. check for valid enum?

In general, internal logic is based on isCascade* properties of mapping and it works fine.

Property cascade is required only by ResolveTargetDocumentListener to keep tracking input cascade option for remapping, as ClassMetadataInfo::mapField() expects only cascade, but not isCascade*. And it exists only if cascade was explicitly set.

@jmikola
Copy link
Member

jmikola commented Jun 6, 2014

@jaymecd: You last comment explained it. It wasn't clear to me from the original PR message what the change accomplished, but I see what you're referring to about the cascade property now. Thanks!

@jmikola jmikola changed the title clean-up and respect $mapping[cascade] Ensure "cascade" mapping is set for ResolveTargetDocumentListener Jun 6, 2014
@jmikola jmikola added the bug label Jun 6, 2014
jmikola added a commit that referenced this pull request Jun 6, 2014
@jmikola
Copy link
Member

jmikola commented Jun 6, 2014

Merged in a6bd9a8 with some amending to the commit message.

@jaymecd
Copy link
Contributor Author

jaymecd commented Jun 6, 2014

Welcome and thank you too.

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.

3 participants