Bake not generating 100% new model-files?

My favourite cakephp-command is ‘cake bake all --everything -f’. My expectation was that using this command I got rid of all the changes I made to the code and should get a fresh build. But apparently at least some changes stay persistent.

For example, first thing I do after baking is changing display fields from id’s to another field. When rebaking, display-fields don’t change back to id’s. Console tells me models are rewritten (no errors), timestamp on file tells me it’s a new file.

Can’t find any info in the manual about this behaviour, is it a bug or is it a feature :slight_smile:

Sometimes I can’t get the baked application working properly after the ‘bake all --everything’, and I just delete all baked files. So I think I’m missing something?

What fields are you using as display fields? The bake often chooses other fields than the ids for me, like “name” or “description” strings, so maybe it’s just being smart enough to choose the fields that you wanted to use?

That’s interesting, I’ve bake never seen choosing another display field, always the ‘id’ (I’m using CakePHP 3.7). Maybe a convention I’m missing?

To test this behaviour, I use two tables, ‘compositions’ (with fields ‘id’, ‘composition’, ‘description’) and ‘items’ (with fields ‘id’, ‘item’, ‘composition_id’, ‘description’).

Bake generates innitially a model ‘CompositionsTable’ with DisplayField ‘id’. I repeatedly changed it to ‘composition’, ‘description’ and ‘id’ etc., after every bake the DisplayField kept the value I set it manually to.

The list of ‘items’ keeps showing the at that moment intended value for composition as set in the DisplayField.