Description
Bug Report
Q | A |
---|---|
BC Break | no |
Version | 2.2.0 |
Summary
I use XML to map the documents.
When I set the attribute nullable=true
to a property, which is an embedded document (embed-*
), the ClassMetadata
resulted always set this property to ClassMetadata->isNullable() === false
.
By the way, mapping with annotations works well.
Here is an example of the mapping:
<document name="Model\Cart" collection="carts">
<embed-one field="shippingAddress" target-document="Model\ShippingAddress" nullable="true"/>
Current behavior
Whatever the attribute nullable
is, when it's set to an embedded document property, the ClassMetadata->isNullable()
always returns false
.
For annotation mapping, there is no problem because all the metadata provided in annotations are merged to build the ClassMetadata
.
But for XML, the metadata are built attribute by attribute and there is no part dealing with nullable
.
See
mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php
Lines 354 to 395 in 8069ded
Expected behavior
If the nullable
attribute is set to true
to an embedded document property, the ClassMetadata->isNullable()
must returns true
.