-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix empty date/times being marshalled incorrectly.
Empty values should be marshalled into null. Not doing this makes saving empty date inputs impossible. Refs #5723
- Loading branch information
Showing
4 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4c9d704
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent ! Thank you Mark. That fixed the problem.
Could it be a future requirement to automatically include "array('empty' => true, 'default' => '') in the generated "cake bake" code for date_of_birth in add.ctp and edit.ctp when defined as "date DEFAULT NULL" in the database ?
4c9d704
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure you can make a pull request to cakephp/bake 😄
4c9d704
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@renardrouge Why default ''? The empty true part I understand - and agree ;)
4c9d704
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello euro Mark !
With just 'empty' => true, this is the result:
and on Submit, the DEFAULT NULL field is filled with the current date.
If 'default' => '' is added, this is the result:
and on Submit, the DEFAULT NULL field is NULL.