You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The the COLLECTION_PER_CLASS inheritance means there is 1 collection per Document class. Which is not different from how all the Document classes works.
#[ODM\InheritanceType('COLLECTION_PER_CLASS')]
#[ODM\DiscriminatorMap([3 => Tag::class, 4 => Category::class])]
class Section {}
class Tag extends Section {}
class Category extends Section {}
If you run a query on the Section repository, the section collection is queried. There is no way to get a Tag or Category object in this way.
If you run a query on the Tag repository, the tag collection is queried. There is no way to get a Category object in this way. The discriminator field is not necessary.
This feature has an issue as we cannot guarantee that 2 documents doesn't share the same _id, as they are in distinct collections. #2725 (comment)
Feature Request
Summary
The the
COLLECTION_PER_CLASS
inheritance means there is 1 collection per Document class. Which is not different from how all the Document classes works.Getting the example from #2726
If you run a query on the
Section
repository, thesection
collection is queried. There is no way to get aTag
orCategory
object in this way.If you run a query on the
Tag
repository, thetag
collection is queried. There is no way to get aCategory
object in this way. The discriminator field is not necessary.This feature has an issue as we cannot guarantee that 2 documents doesn't share the same
_id
, as they are in distinct collections. #2725 (comment)This feature has almost no documentation: https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.9/reference/inheritance-mapping.html#collection-per-class-inheritance
The text was updated successfully, but these errors were encountered: