- Issue created by @司南
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