8000 Nested embedded entities not fully loaded · Issue #6523 · mikro-orm/mikro-orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Nested embedded entities not fully loaded #6523
Open
@NicklasKnell

Description

@NicklasKnell

Describe the bug

I have a nested embedded structure similar to the one in this issue, the difference is mostly that in the current issue I have one more abstract embeddable so more or less the workaround the issue 6522.

Logging the created entity we get this structure

    ChangeOwner { // change owner is the ouer most entity
      id: 1,
      fields: [ // fields is an polymorphic array embeddable 
        ChangeBooleanValue { // the issue only seems to exist for the boolean version of the polymorphic embeddable
          type: 'BOOLEAN',
          entries: [
            BooleanChangeEntry { // the nested embeddable which is also theoretically polymorphic 
              type: 'BOOLEAN',
              value: true
            } 
          ]
        }
      ]
    }

If we persist and flush this, the db entry looks good, but after querying this with await orm.em.findOneOrFail(ChangeOwner, 1) we receive the entity like this

    ChangeOwner {
      fields: [ ChangeBooleanValue { type: 'BOOLEAN', entries: [] } ],
      id: 1
    }

So the inner array is just completely lost. If after querying we flush without doing anything else, the entity will be updated.

In my reproduction I also queried the entity using knex to demonstrate that it actually is stored correctly in the db.

Reproduction

https://github.com/NicklasKnell/reproduction/blob/embeddable-data-deletion-on-query/src/example.test.ts

What driver are you using?

@mikro-orm/postgresql

MikroORM version

6.4.10

Node.js version

v22.9.0

Operating system

Ubuntu 22.04.5 LTS

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0