Doctrine ODM Document with Two Discriminator Fields

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

Example: We have the category "element" and the subcategories "element" (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: ...
}

, ? , dicriminator Element, , . , . , doc. ony Element.

/**
 * @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{} 
+3

All Articles