Skip to content

1:m or n:m relationships #4

@blue995

Description

@blue995

Is it possible to define multiple references to other entities?

In this example i want to define a 1:m relationship (1 Object has n images)

[
  {
    "target_class": "database.model:Image",
    "data": [
      {
        "path": "path/to/some/picture",
        "title": "01"
      }
    ]
  },
  {
    "target_class": "database.model:ImageContainer",
    "data": [
      {
        "id": 1,
        "!refs": {
          "images": {
            "target_class": "database.model:Image",
            "criteria": {
              "title": "01"
            }
          }
        }
      }
    ]
  }
]

When i try to read the new entities from the json file i get the following type error:
TypeError: Incompatible collection type: Image is not list-like

Thats because my ImageContainer object expects a list of Image objects as image property.
I couldn't find anything in the documentation about this topic and i tried several things to make it work. Do you have any suggestions or is it not implemented yet?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions