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:
parent
38221e0605
commit
c8576ea2db
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue