Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1, 1.0.0BETA2
-
Fix Version/s: 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1, 1.0.0BETA2
-
Component/s: Mapping Drivers
-
Labels:None
-
Environment:Symony2
Doctrine2 latest from github
Description
The discriminatorField and discriminatorMap options are ignored by both the YAML and XML drivers.
Example:
This mapping fails to store the discriminator in the type field and instead uses _doctrine_class_name as the discriminatorField the mapping also reverts to using class names.
<?xml version="1.0" encoding="UTF-8"?> <doctrine-mongo-mapping> <document name="Application\Test\Document\Group" collection="groups"> <field name="id" fieldName="id" id="true" /> <field name="name" fieldName="name" type="string" /> <embed-many field="people" discriminator-field="type"> <discriminator-map> <discriminator-mapping class="Admin" value="Admin" /> <discriminator-mapping class="User" value="User" /> </discriminator-map> </embed-many> </document> </doctrine-mongo-mapping>
I think that this is also a problem for referenced documents as well, as the code for the two is nearly identical.
I refactored addEmbedMapping and addReferenceMapping to call the same function addDocumentMapping
Commit can be found here http://github.com/dordille/mongodb-odm/commit/41ce2ee126ff7f82610130704dbec451384bfdd3
Merged! Thanks for the fix!