I am having an issue getting a custom model's value to update to NULL.
$model = Mage::getModel('custom/model')->load($id);
$model->setCustomValue(NULL);
$model->save();
This code does not update the field custom_value
in the database, and the database value accepts NULL values (Manually setting NULL in the database works fine).
EDIT:
As Tim mentions below using Zend_Db_Expr("NULL")
does set the value to null, could anyone explain why this is required in Magento and not just simply a php NULL
?
double
and I have tried other numeric types likedecimal
and doing$model->setCustomValue("");
sets the value to0
$null = new Zend_Db_Expr("NULL");
?