- First commit to issue fork.
EntityFieldDefinitionTrait::getEntityTypeId() assumes that it is in a plugin whose ID is of the form 'foo:ENTITY_TYPE'.
This means that if you want to use ContentEntity as a base class for a custom source plugin, getEntityTypeId() fails to find the entity type.
The function is redundant, at least within ContentEntity's use of the trait, because ContentEntity does this in __construct():
$this->entityType = $this->entityTypeManager->getDefinition($plugin_definition['entity_type']);
so the entity type and its ID are always available.
A workaround is to override the trait's method like this:
/**
* {@inheritdoc}
*/
protected static function getEntityTypeId($plugin_id) {
// Override this so it doesn't try to get the entity type ID from the plugin
// ID, which will fail.
return 'my_entity_type';
}
but this violates DRY.
Remove the method and get the entity type ID from $this->entityType->id().
Active
11.0 🔥
Enhances developer experience.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.