I have three custom entities, all generated with Drupal Console. I only added some basicFieldDefinitions to them before testing some CRUD operations on them.
I have these entities:
- ConfigEntity (config entity - lowest level)
- ChildEntity (content entity - has an entity_reference field to ConfigEntity)
- ParentEntity (content entity - has an entity_reference field to ChildEntity)
When I display the name of the ConfigEntity through the entire chain, it displays properly
// "Original Value"
$parentEntity->get('child_entity')->entity->get('config_entity')->entity->label()
When I update the name, it still displays the original value through the chain, although printing it from the entity itself, it is the new value.
// "Original Value"
$parentEntity->get('child_entity')->entity->get('config_entity')->entity->label();
$configEntity = ConfigEntity::load(1);
$configEntity->set('label', "New Value")->save();
$configEntity = ConfigEntity::load(1);
// "New Value"
$configEntity->label();
$parentEntity = ParentEntity::load(1);
// "Original Value" instead of "New Value"
$parentEntity->get('child_entity')->entity->get('config_entity')->entity->label();
Any idea if there's a cache tag mechanism I have to implement manually, or something I have to invalidate myself in code?