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

Remove default value from type attribute #1685

Merged
merged 1 commit into from
Dec 5, 2017

Conversation

MidnightDesign
Copy link
Contributor

The XSD defines a default value (string) for the type attribute of the field tag. PhpStorm (or an extension?) even issues a warning ("Redundant default attribute value assignment") when I set the attribute to string.

So either the code has to be changed to reflect the XML definition, or the definition needs to be changed - which this PR does.

The XSD defines a default value (`string`) for the `type` attribute of the `field` tag. PhpStorm (or an extension?) even issues a warning ("Redundant default attribute value assignment") when I set the attribute to `string`.

So either the code has to be changed to reflect the XML definition, or the definition needs to be changed - which this PR does.
@alcaeus
Copy link
Member

alcaeus commented Dec 5, 2017

I'll have to check whether this makes sense: if there is a default type in the XmlDriver or the mapping itself, it should be reflected in the schema (as it is now).

You can help this by writing a test case that loads an XML mapping containing a field without a type specified: the field shouldn't have a type of string. If it's handled as a string, the default needs to remain in the schema.

@MidnightDesign
Copy link
Contributor Author

I just realized that I left out the most important part from my original post: If I do omit the type attribute, I get an "Undefined index: type" error. As I said: maybe the code should be fixed instead of the XML definition.

Also, IIRC the ORM has the same problem.

@malarzm
Copy link
Member

malarzm commented Dec 5, 2017

FWIW we're having string as the default in annotations

@alcaeus
Copy link
Member

alcaeus commented Dec 5, 2017

@MidnightDesign in that case, you already answered what I didn't have time to investigate yet. If the code indeed requires you to provide a value for the type attribute, it shouldn't have a default value in the schema. If the same applies to ORM, go ahead and create a pull request there as well.

Thanks!

@alcaeus alcaeus merged commit 0ce620c into doctrine:master Dec 5, 2017
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.

None yet

3 participants