Uploaded image for project: 'Doctrine MongoDB ODM'
  1. Doctrine MongoDB ODM
  2. MODM-31

Cannot use a document against multiple classes


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:


      It would be useful to be able to use two classes on one document, in a way that transparently extends the original schema. My use case:

      I have a base Application that manages users of the system. A module/plugin to the system wants to extend the User records to include references to one of it's documents:

      namespace Application\Model;
      class User {
      //user properties here


      namespace Organisation\Model;
      use Application\Model\User as BaseUser;

      class Organisation {
      //organisations properties

      class User extends BaseUser {
      /** @ReferenceOne(targetDocument="\Organisation\Model\Organisation") */
      protected $organisation

      It this theoretical scenario, the original \Application\Model\User needs to be used by the base application, but the \Organisation\Model\User can be used by the addon module to transparently add more data to the same user. The base class doesn't need to know it will be used this way.

      Current behaviour for the above will ignore the additional properties not available in the parent class, and doesn't throw any exceptions/errors.

      Other ways to make it work involve the base class knowing it will be extended via SCI, or using a mappedsuperclass?, which isn't transparent in the base class, it needs to be altered to work with it's children.



          • Assignee:
            jwage Jonathan H. Wage
            scottaubrey Scott Aubrey
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: