[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
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



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

Merged! Thanks for the fix!

Generated at Wed Sep 03 08:04:08 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.