When saving a custom entity which has a unique key
a duplicate entry exception is thrown and the json api request crashes.
To reproduce this
- Create Custom Entity
- Create a custom storage_schema there and overidde the following function:
/**
* {@inheritdoc}
*/
protected function initializeBaseTable(ContentEntityTypeInterface $entity_type) {
$schema_table = parent::initializeBaseTable($entity_type);
$schema_table['unique keys'] = [
['only_one' => ['some_id', 'some_other', 'another_thing']
];
return $schema_table;
}
Now when a custom entity is created via JSON Api where the only_one rule is violated, the process dies.
Normally the JSON API should send a error message.