schmittjoh/JMSSerializerBundle — pull request #125 by matthiasnoback (2012-06-04 15:44:54+00:00)
Title: Added fix for nested element with attribute and value

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

Matthias Noback
The Netherlands

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?