Doctrine MongoDB ODM
  1. Doctrine MongoDB ODM
  2. MODM-75

mappedSuperclass and embedded document not working with yaml mapping

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0BETA2
    • Component/s: Mapping Drivers
    • Labels:
      None

      Description

      all documents inherits from an abstract class Cgd\DomainObject\DomainObjectAbstract

      The document App\Entity\Contact\Contact has many App\Entity\Contact\Program

      abstract class Cgd\DomainObject\DomainObjectAbstract

      mappedSuperclass
      #Cgd.DomainObject.DomainObjectAbstract.dcm.yml
      Cgd\DomainObject\DomainObjectAbstract:
        type: mappedSuperclass
        fields:
          id:
            fieldName: id
            id: true
          createdAt:
            fieldName: createdAt
            type: date
          updatedAt:
            fieldName: updatedAt
            type: date
        lifecycleCallbacks:
          prePersist: [onPreInsert]
          preUpdate: [onPreUpdate]
      

      Here the inherited class

      class App\Entity\Contact\Contact extends Cgd\DomainObject\DomainObjectAbstract

      InheritedClass
      #App.Entity.Contact.Contact.dcm.yml
      App\Entity\Contact\Contact:
        collection: contacts
        type: document
        fields:
          email:
            fieldName: email
            type: string
          status:
            fieldName: status
            type: int
        embedMany:
          programs:
            targetDocument: App\Entity\Contact\Program
            cascade: all
      

      The embedded

      class App\Entity\Contact\Program extends Cgd\DomainObject\DomainObjectAbstract

      embeddedDocument
      #App.Entity.Contact.Program.dcm.yml
      App\Entity\Contact\Program:
        type: embeddedDocument
        fields:
          name:
            fieldName: name
            type: string
      

      No field from abstract class are populated in embedded document

        Activity

        julien rollin created issue -
        Jonathan H. Wage made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.0.0BETA2 [ 10092 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            julien rollin
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: