From c8576ea2dbc80270190dc31da09964383bd71d32 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 11 Jun 2015 08:11:15 +0200 Subject: [PATCH] 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 03ad5f7376a530715e728072b7489c05194a5bfa. --- library/Director/Data/Db/DbObject.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Director/Data/Db/DbObject.php b/library/Director/Data/Db/DbObject.php index a8d684a7..283f4bd9 100644 --- a/library/Director/Data/Db/DbObject.php +++ b/library/Director/Data/Db/DbObject.php @@ -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)); }