diff --git a/lib/Cake/Model/ConnectionManager.php b/lib/Cake/Model/ConnectionManager.php index 4437ec435..eaa62bde6 100644 --- a/lib/Cake/Model/ConnectionManager.php +++ b/lib/Cake/Model/ConnectionManager.php @@ -86,8 +86,7 @@ class ConnectionManager { } if (!empty(self::$_dataSources[$name])) { - $return = self::$_dataSources[$name]; - return $return; + return self::$_dataSources[$name]; } if (empty(self::$_connectionsEnum[$name])) { diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 61952a13d..035a062ef 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1689,6 +1689,8 @@ class Model extends Object implements CakeEventListener { } } + $db = $this->getDataSource(); + if (empty($this->data[$this->alias][$this->primaryKey])) { unset($this->data[$this->alias][$this->primaryKey]); }