Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298901

JSON:API with custom entity with separate unique keys

$
0
0

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.


Viewing all articles
Browse latest Browse all 298901

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>