be more robust when creating keyfield config
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 30 Aug 2016 14:18:19 +0000 (16:18 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 2 Sep 2016 11:14:00 +0000 (13:14 +0200)
... and log any error

Change-Id: I0667bbe548d779e65bb1b643e1f6476b6afc3f30
Reviewed-on: http://gerrit.tine20.com/customers/3498
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Config/KeyField.php

index d53c068..4900cda 100644 (file)
@@ -63,7 +63,12 @@ class Tinebase_Config_KeyField extends Tinebase_Record_Abstract
             $record->setKeyFieldRecordModel($_options['recordModel']);
         }
 
-        $record->setFromArray($_data);
+        if (is_array($_data)) {
+            $record->setFromArray($_data);
+        } else if (is_string($_data)) {
+            if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::'
+                . __LINE__ . ' Did not get an array to set keyfield config. Got this: ' . $_data);
+        }
         return $record;
     }