I have 3 custom modules that provide custom entities with all fields defined as base fields.
Contact module - provides a contact entity(it could be one of the type: a person or email or phone etc) that has a store entity reference field.
Store module - provides a store entity that has a region entity reference field.
Region module - provides geographical region entity that has a contact entity reference field.
So
- Contact depends on Store
- Store depends on Region
- Region depends on Contact
Each definition would look like this:
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
...
$fields['store'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Store'))
->setDescription(t('Select the store the contact is part of.'))
...
->setSetting('target_type', 'custom_store')
...
}
As these modules provide more than just entity (and custom field API plugins), We can't combine them together.
when trying to install the modules, getting an unknown entity target_type error.