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

Added fix for nested element with attribute and value #125

Merged
merged 1 commit into from
Jun 4, 2012
Merged

Added fix for nested element with attribute and value #125

merged 1 commit into from
Jun 4, 2012

Conversation

matthiasnoback
Copy link

Hi Johannes,

First of all: thank you for sharing this beautiful bundle!

I fixed an issue with the hasValue property of the XmlSerializationVisitor. The visitor remembers the use of @XmlValue even when it is already outside the element it applies to. So when trying to create XML like

<person_collection>
  <person age="28">Matthias Noback</person>
  <location>The Netherlands</location>
</person_collection>

It fails on the "location" property, saying:

RuntimeException: If you make use of @XmlValue, all other properties in the class must have the @XmlAttribute annotation. Invalid usage detected in class JMS\SerializerBundle\Tests\Fixtures\PersonCollection.

It is a small fix (just reset the $hasValue property to false) for which I've added some tests. The existing tests don't fail with this fix in place.

Could you take a look at this please?

schmittjoh added a commit that referenced this pull request Jun 4, 2012
…ttribute_and_value

Added fix for nested element with attribute and value
@schmittjoh schmittjoh merged commit 71643cb into schmittjoh:master Jun 4, 2012
@schmittjoh
Copy link
Owner

Thanks for the PR!

@matthiasnoback
Copy link
Author

And thanks for merging so quickly!

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.

2 participants