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

Default values for Comments #41

Closed
BenjaminPaap opened this issue Sep 8, 2014 · 1 comment
Closed

Default values for Comments #41

BenjaminPaap opened this issue Sep 8, 2014 · 1 comment

Comments

@BenjaminPaap
Copy link
Contributor

With Pull-Request #35 default values for comments were added. Correct me if I'm wrong but this code will produce false als output:

$date = new \DateTime("0000-00-00");
var_dump($date->format("Y-m-d") == "0000-00-00");

So you can't set the date like this as default. I think it is not even possible with standard doctrine components.

@Draeli
Copy link
Contributor

Draeli commented Sep 25, 2014

I think it's due to DateTime behavior, for example :

$date = new \DateTime("0000-00-00");

in this case, if you dump, you have something like :

object(DateTime)[1]
  public 'date' => string '-0001-11-30 00:00:00' (length=20)
  public 'timezone_type' => int 3
  public 'timezone' => string 'Europe/Paris' (length=12)

with invalid "date" (negative).

May be this trike is an available correction :

new \DateTime('@0')

Edit : reading again, I saw the target is Doctrine, in this case I don't now what happened but for database storage I suppose you can't set the date '0000-00-00' and may be add a Transform for invalid date or null date.

@eko eko closed this as completed in f950cf4 Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants