Tuesday, April 29, 2014

Re: cake 3 - issue saving null datetime

yep :)


2014-04-29 0:07 GMT+02:00 euromark <dereuromark@gmail.com>:
See - already fixed after not even 1 hour :)

Am Montag, 28. April 2014 22:35:02 UTC+2 schrieb bato:
I opened an issue https://github.com/cakephp/cakephp/issues/3410

Il giorno lunedì 28 aprile 2014 18:46:28 UTC+2, euromark ha scritto:
Sounds like the case here.
You maybe should open a github issue regarding this.

Am Montag, 28. April 2014 10:15:44 UTC+2 schrieb bato:
Hi all,

I have a table with a field 'date_start' that can be nullable. I have a fatal error when try to save null value on db.
In my controller I have:

$data['start_date'] = null;
$c = TableRegistry::get('Contents');
$e = $c->newEntity($data);
$c->save($e);

and the fatal error is

Error: Call to a member function format() on a non-object
File /..../vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php
Line: 62

I think there is a bug because the  Cake\Database\Type\DateTimeType::toDatabase($value, Driver $driver) method doesn't check if $value is null and try to use a method on it $value->format($this->_format);

Is it a bug?

alberto

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/TU6D6QnnFKI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.



--
------ bato -------

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: