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 the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to