When I add or modify mutator methods (e.g., _setX) in an Entity class, these changes may not be recognized immediately due to cached model metadata stored in tmp/cache/models/. This can lead to confusion and wasted development time, especially when debugging why a new mutator isn’t being triggered.
This behavior is not clearly documented, and developers may spend significant time debugging issues that are simply due to stale cache.
Now I know this issue and I always delete files in tmp/cache/models/ to solve this issue.
Making this explicit in the documentation would improve developer experience and reduce frustration. I suggest to add a note to the Entities documentation page.
You are confusing a few things here. The cache you are mentioning is about the structure of the tables (DB table column schema), not the content.
So when you modify via mutator, it modifies actually neither the structure, nor the DB table row (data).
It only modifies an entity and its content.
Unless you save it afterwards, then it saves that to the DB.
But that still has nothing to do with the schema and cache. It works independently from that.
Having a setter is irrelevant here. The value (and/or the value_xx) fields would be ignored when saving the data if they are not present in the cached table schema.
Regenerating schema cache when deploying is deployment 101.