Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"cake bake all" should include 'empty' => true, 'default' => '' for date DEFAULT NULL fields #35

Closed
renardrouge opened this issue Feb 4, 2015 · 6 comments · Fixed by #173

Comments

@renardrouge
Copy link
Contributor

For a database field defined "date DEFAULT NULL" a user must currently modify the generated add.ctp and edit.ctp code to include ' array('empty' => true, 'default' => '') ' for the application to store correctly a NULL.

The current generated code is echo $this->Form->input('date_of_birth'); and the result on Submit is to store the date displayed in the 'date_of_birth' panel.
null_date_8

A test case is produced by doing a "cake bake all users" on the following table.
CREATE TABLE IF NOT EXISTS users (
id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
username varchar(254) NOT NULL,
user_email varchar(254) NOT NULL,
date_of_birth date DEFAULT NULL,
UNIQUE KEY (username),
KEY (user_email),
PRIMARY KEY (id)
);

@markstory markstory added this to the 1.0.0 milestone Feb 4, 2015
@markstory markstory modified the milestones: 1.0.0, 1.0.2 Mar 24, 2015
@lorenzo lorenzo modified the milestones: 1.0.2, 1.0.3 Mar 25, 2015
@markstory markstory modified the milestones: 1.0.3, 1.0.4 Apr 6, 2015
@markstory markstory modified the milestones: 1.0.5, 1.0.6 Apr 27, 2015
@markstory markstory modified the milestone: 1.0.6 May 11, 2015
@dereuromark
Copy link
Member

With the change of cakephp/cakephp#6559 only empty => true is required to be added for DEFAULT NULL fields.

@renardrouge
Copy link
Contributor Author

Thank you Mark !

A couple of months ago I began to look at the problem of "single quotes"
not being rendered properly for the PDF code documentation.
It seems that a person who really knows the internals of LaTex could
come up with a clean solution.
Unfortunately I was unable to understand where in LaTex such a change
might be made.

I looked at the Jenkins logs trying to determine the process. I am on a
Windows 7 platform so I was unable to duplicate the process.

However I was able to come up with a crude solution which worked on my
sample of one piece of auth.rst code.
It consists of a PHP preprocessor which scans .tex code produced by
rst2latex for single quotes and substitutes the appropriate
"\textquotesingle".
The resulting .tex file was then run through a Windows pdfLaTex program
to produce a correct representation of PDF code documentation.

I have attached that piece of preprocessor code. If you think it has
any merit as a solution it is yours to use as you see fit.

Best regards

Lorne

On 14/05/2015 6:58 AM, Mark S. wrote:

With the change of cakephp/cakephp#6559
cakephp/cakephp#6559 only |empty => true| is
required to be added for DEFAULT NULL fields.


Reply to this email directly or view it on GitHub
#35 (comment).

@dereuromark
Copy link
Member

Are you sure you wanted to answer this issue? Your report looks totally off topic..

@renardrouge
Copy link
Contributor Author

Sorry Mark !

I have been away from cakePHP work for a couple of months.
I neglected to notice that your email was tied to the particular github
issue.
This relates to an old issue.
It was intended for your personal attention only, to do with as you please.

On 14/05/2015 1:57 PM, Mark S. wrote:

Are you sure you wanted to answer /this/ issue? Your report looks
totally off topic..


Reply to this email directly or view it on GitHub
#35 (comment).

@DSchalla
Copy link
Contributor

I will try to take care of this today.

//Edit: Postponed to tomorrow (30.10), sorry.

@markstory
Copy link
Member

Thanks @DSchalla

markstory added a commit that referenced this issue Oct 31, 2015
Remove unnecessary attribute from date inputs (Closes #35)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants