#283 Fixed issue with the default value of Enum attributes

SVN:trunk[891]
This commit is contained in:
Romain Quetiez
2010-10-13 08:23:05 +00:00
parent 05dbcb0a8b
commit 0fff433e90
2 changed files with 90 additions and 0 deletions

View File

@@ -1096,6 +1096,22 @@ class AttributeEnum extends AttributeString
}
}
public function ScalarToSQL($value)
{
// Note: for strings, the null value is an empty string and it is recorded as such in the DB
// but that wasn't working for enums, because '' is NOT one of the allowed values
// that's why a null value must be forced to a real null
$value = parent::ScalarToSQL($value);
if ($this->IsNull($value))
{
return null;
}
else
{
return $value;
}
}
public function RequiresIndex()
{
return false;