-
-
Notifications
You must be signed in to change notification settings - Fork 512
Description
Feature Request
| Q | A |
|---|---|
| New Feature | no |
| RFC | yes |
| BC Break | yes |
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
#[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)
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