I am trying to write a record into a compound key table.
The table has three fields: 'ID', 'description' and 'languageText_KEY'.
The table contains translations for another table and is linked by 'ID'.
'ID and 'languageText_KEY' are the compound keys.
I am getting a validation error: "When inserting into a compound key table, all fields that are part of the compound key must be submitted with a specific value."
I don't understand why this error is generated because i can see in the headers of the POST request that all compound key fields posted have specific values.
The PHP code used:
$editor = Editor::inst($db, 'tblLogTrendKonfig_Text', ["ID","languageText_KEY"]);
$editor->debug(false);
$editor->write(true);
$f = Field::inst('tblLogTrendKonfig_Text.ID');
$f->setFormatter(Format::ifEmpty(null));
$fields[] = $f;
$f = Field::inst('tblLogTrendKonfig_Text.description');
$f->setFormatter(Format::ifEmpty(null));
$fields[] = $f;
$f = Field::inst('tblLogTrendKonfig_Text.languageText_KEY');
$f->setFormatter(Format::ifEmpty(null));
$fields[] = $f;
$editor->fields($fields);
$editor->process($_POST)->json();
I cannot change the table design unfortunately otherwise I would.
To me it make more sense to have a unique ID and a TEXT_ID field linked to the the other table.
But unfortunately I cannot change it.
Anyone know why this validation error is generated?