- Issue created by @司南
- 🇪🇸Spain pcambra Asturies
Probably related to 🐛 JSON:API assumes entity reference field's main property must be the entity ID Active and https://www.drupal.org/node/3519887 →
entity_reference field type need a fixed entity type to be configured, this code miss it:
src/Entity/Like.php
$fields['entity_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Entity ID'))
->setDescription(t('The ID of the entity of the like.'))
->setRequired(TRUE);
Since entity_id field here need to accept entity id of any entity type, it should not use the entity_reference field type.
Simply change the field type to integer can resolve this proplem.
$fields['entity_id'] = BaseFieldDefinition::create('integer')
->setLabel(t('Entity ID'))
->setDescription(t('The ID of the entity of the like.'))
->setRequired(TRUE);
Active
2.0
Code
Probably related to 🐛 JSON:API assumes entity reference field's main property must be the entity ID Active and https://www.drupal.org/node/3519887 →