Content-Length: 326578 | pFad | https://github.com/doctrine/mongodb-odm/pull/1814

F3 [2.0] Validate mapping files against schema by alcaeus · Pull Request #1814 · doctrine/mongodb-odm · GitHub
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

[2.0] Validate mapping files against schema #1814

Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jun 15, 2018

Q A
Type improvement
BC Break yes

Summary

With this change, invalid XML mapping files are no longer accepted by the XML driver. It also replaces the pesky sequence element in the schema with choice, allowing fields in any order the user wants to map them. This mirrors a change done in ORM a while ago.

Last but not least, this removes leftover handling for the id attribute in the field mapping that should have been removed in #1807.

When backporting this feature to 1.3, we have to introduce a strict mode for mapping files that is disabled by default. When disabled, it will trigger a deprecation warning to inform the user that it will throw exceptions in 2.0; when enabled, it will behave like the driver in 2.0 and throw exceptions on invalid mapping files.

@alcaeus alcaeus added this to the 2.0.0 milestone Jun 15, 2018
@alcaeus alcaeus self-assigned this Jun 15, 2018
@alcaeus alcaeus changed the title Validate mapping files against schema [2.0Validate mapping files against schema Jun 15, 2018
@alcaeus alcaeus changed the title [2.0Validate mapping files against schema [2.0] Validate mapping files against schema Jun 15, 2018
Copy link
Member

@malarzm malarzm left a comment

Choose a reason for hiding this comment

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

Nice one 👍

$document->load($filename);

try {
$previousUseErrors = libxml_use_internal_errors(true);
Copy link
Member

Choose a reason for hiding this comment

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

Moving this outside of the try block should be safe and satisfy PHPStan

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes, good point! 👍

@alcaeus alcaeus force-pushed the validate-mapping-files-against-schema branch from ca7348e to 4e73b85 Compare June 15, 2018 14:01
@alcaeus alcaeus requested a review from malarzm July 24, 2018 18:38
@alcaeus alcaeus merged commit c6000a7 into doctrine:master Jul 27, 2018
@alcaeus alcaeus deleted the validate-mapping-files-against-schema branch July 27, 2018 05:19
alcaeus added a commit to alcaeus/mongodb-odm that referenced this pull request Jan 9, 2019
@alcaeus alcaeus mentioned this pull request Jan 9, 2019
alcaeus added a commit to alcaeus/mongodb-odm that referenced this pull request Jan 10, 2019
alcaeus added a commit to alcaeus/mongodb-odm that referenced this pull request Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/doctrine/mongodb-odm/pull/1814

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy