Is it someway possible to have two discriminator fields in one document? I 
have a collection Logs in Mongo. Each log has a category field and an 
action field. The combination of those fields forms the structure of the 
Log. 

Example: We have a category "element" and subcategories of "element" (the 
action field) "create", "file"

// Log element.create{     //common Log attributes
     category: 'element',
     action: 'create',
     //specific attributes for each Log type
     parent_element: ...}// Log element.file{     //common Log attributes
     category: 'element',
     action: 'file',
     //specific attributes for each Log type
     file_size: ...
     file_type: ...}

Is there a workaround how to get from document manager instances of correct 
Classes by those two fields ? I tried to create a Base Log Class that has 
the dicriminator field for the category attribute and an Element Class that 
extends Base Log class and it this class I set the dicriminator field for 
the action attribute. Then a Create Class that extends the Element. But 
this way it doesn't work 'cause doc. manager returns ony Element instances.

/**
 * @ODM\Document(collection="log")
 * @ODM\InheritanceType("SINGLE_COLLECTION")
 * @ODM\DiscriminatorField("category")
 * @ODM\DiscriminatorMap({
 *      "element"="Element"
 * })
 */class Log {}  
/**
 * @ODM\Document
 * @ODM\InheritanceType("SINGLE_COLLECTION")
 * @ODM\DiscriminatorField("action")
 * @ODM\DiscriminatorMap({
 *      "create"="Create"
 * })
 */class Element extends Log{} 
/**
 * @ODM\Document
 */class Create extends Element{} 

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to