Skip to content

Warning when trying to save a list into a one to one relationship #1634

@tintin10q

Description

@tintin10q

Describe the feature

Today I specified something as a oneToOne relationship but I thought I had specified it as a one to many relationship. I then inserted a list of items and I got the error:

Uncaught Error: [Pinia ORM] The record is missing the primary key. If you want to persist record without the primary key, please define the primary key field with the `uid` attribute.

Now I realize it probably could not find the id because I passed a list and that list of course does not have an id field. When I finally figured this out I remembered that I have gone through this already before.

Maybe before raising this error there could also be a check to see if the item we are checking the id for is a list. If it is a list there could be a warning like:

Warning: [Pinia ORM] You passed a list into a oneToOne relationship. 

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions