[MODM-93] YAML and XML mapping drivers ignore discriminatorField and discriminatorMap Created: 24/Oct/10  Updated: 24/Nov/10  Resolved: 24/Nov/10

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
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

Type: Bug Priority: Major
Reporter: Dan Ordille Assignee: Jonathan H. Wage
Resolution: Fixed Votes: 0
Labels: None

Doctrine2 latest from github


The discriminatorField and discriminatorMap options are ignored by both the YAML and XML drivers.

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"?>
    <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-mapping class="Admin" value="Admin" />
                <discriminator-mapping class="User" value="User" />

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

Comment by Jonathan H. Wage [ 24/Nov/10 ]

Merged! Thanks for the fix!

Generated at Tue Oct 06 20:25:29 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.