Revert "DbObject: do not treat an empty string as null"

This was needed as we get empty strings from form fields. Should be
fixed in our forms, restoring former behavior right now.

This reverts commit 03ad5f7376.
This commit is contained in:
Thomas Gelf 2015-06-11 08:11:15 +02:00
parent 38221e0605
commit c8576ea2db
1 changed files with 4 additions and 1 deletions

View File

@ -183,6 +183,7 @@ abstract class DbObject
*/
protected function onDelete() {}
/**
* Set DB adapter
*
@ -245,7 +246,9 @@ abstract class DbObject
public function set($key, $value)
{
$key = (string) $key;
if ($value === '') {
$value = null;
}
if (! $this->hasProperty($key)) {
throw new Exception(sprintf('Trying to set invalid key %s', $key));
}