Skip to content

Error creating entry with many to many relationship #145

@hybridsimone

Description

@hybridsimone

Hello,
I have the following many to many relationship in my code:

{
                "name": "newsCategory",
                "verbose": "Kategorie",
                "control": {
                    "select": true,
                    "multiple": true
                },
                "manyToMany": {
                  "link": {
                      "table": "newsCategory",
                      "parentPk": "News_ID",
                      "childPk": "Category_ID"
                  },
                  "ref": {
                      "table": "category",
                      "pk": "ID",
                      "columns": [
                          "Name"
                      ]
                  }
                },
                "type": "varchar(255)",
                "allowNull": false,
                "listview": {
                    "show": true
                },
                "editview": {
                    "show": true
              }
}

but when I try to add a new 'News' entry, I get the error:
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect integer value: '' for column 'News_ID' at row 1.

The entry still gets saved but not the 'newsCategory'. When I get back to edit it again I can choses categories and also save them without error.
It seems like there is a problem creating an entry and simultaneously using its (auto generated) ID as a foreign key...

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions