Set the value on $this->data to null for that field:
$this->data['Waypoint']['altitude'] = null;
$this->Waypoint->save($this->data);
You can see this on cake/libs/model/datasources/dbo_source.php:
function update(&$model, $fields = array(), $values = array()) {
// ...
if ($value === null) {
$updates[] = $this->name($field) . ' = NULL';
} else {
$updates[] = $this->name($field) . ' = ' .
$this->value($value, $model->getColumnType($field));
}
}
-MI
---------------------------------------------------------------------------
Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.
BAKE ON!
blog: http://www.MarianoIglesias.com.ar
-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Michal Bilcik
Enviado el: Sábado, 24 de Febrero de 2007 03:14 p.m.
Para: [email protected]
Asunto: How to update model with NULL value in decimal field
How can I say to CakePHP to use NULL instead of empty string when
model field (altitude) is not set ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---