Return value if value are 0

Save correctly if the value is 0, but after the find is returned as an empty string.
This commit is contained in:
Raffaele 2014-01-03 15:46:09 +01:00
parent cfa104577f
commit a4f138813b

View file

@ -305,7 +305,9 @@ class TranslateBehavior extends ModelBehavior {
} }
} else { } else {
$value = ''; $value = '';
if (!empty($row[$Model->alias][$aliasVirtual])) { if (is_numeric($row[$Model->alias][$aliasVirtual])) {
$value = $row[$Model->alias][$aliasVirtual];
} elseif (!empty($row[$Model->alias][$aliasVirtual])) {
$value = $row[$Model->alias][$aliasVirtual]; $value = $row[$Model->alias][$aliasVirtual];
} }
$row[$Model->alias][$aliasField] = $value; $row[$Model->alias][$aliasField] = $value;