Referenced entities show old value when changing properties 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-&gt;get('child_entity')-&gt;entity-&gt;get('config_entity')-&gt;entity-&gt;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-&gt;get('child_entity')-&gt;entity-&gt;get('config_entity')-&gt;entity-&gt;label();

$configEntity = ConfigEntity::load(1);
$configEntity-&gt;set('label', "New Value")-&gt;save();

$configEntity = ConfigEntity::load(1);

// "New Value"
$configEntity-&gt;label();

$parentEntity = ParentEntity::load(1);

// "Original Value" instead of "New Value"
$parentEntity-&gt;get('child_entity')-&gt;entity-&gt;get('config_entity')-&gt;entity-&gt;label();


Any idea if there's a cache tag mechanism I have to implement manually, or something I have to invalidate myself in code?
You can clear the static entity cache with EntityStorageBase::resetCache:

\Drupal::entityTypeManager()-&gt;getStorage('parent_entity')-&gt;resetCache([$parentEntity-&gt;id()]);