I had hoped the developers had simply thought of being able to suppress database defaults from showing in the UI. $this->Form->control(…, [‘default’=false]) seems to me to be how it should work. As well as allowing us to override the database default with our own value.
The way Cake implements it, it’s “too smart” imo. Now I feel like I have to get rid of all the defaults I set up in the database. Which, honestly, are mostly about making it easier to create records on the back end for seeding, testing, or other purposes — without having to be troubled with manually inputting every last detail. An admin sometimes faces the need to create new records, and some fields are simply required for the data to work correctly in the app while not being relevant (at least at the time) to whatever the admin has to accomplish, knowing such records can have their details fleshed out later (or the records completely deleted).
Defaults in the database make placeholder text non-viable. Great for data integrity, terrible for UX. I can’t recall any time as a user I needed to see a default value show up in a form field. Never. Ok, in some applications, default values for settings or parameters are absolutely called for. But that is a very specific use case.
As for combining add and edit, it’s because they are exactly the same thing in most cases. The only differences being whether an ID exists or not, and whether there is already data or not. There are an awful lot of records that are created for app development that are never edited. Maybe exceptionally so. Why recreate the exact same functionality?
Think of when you create a new Word Doc. Does the GUI look any different compared to when you open it later? Nope. The only functional difference between creating a new document and editing an existing document is that the new document has no user-generated name and hasn’t been committed to disk. Other than that, they are the exact same “form” presented to the user.
On that same note, I wish Cake would allow for reusing edit actions and views but with read-only access applied. I don’t need a whole entire view action and view just to look at the same data in the same overall layout as you would find in the edit version. A switch like that would be a monumental time saver. Just skip generating the form and render form controls as pure values. Done.