From 5026a535a14ac977ed6565be20df8c2461d43cfd Mon Sep 17 00:00:00 2001 From: Robert K Date: Mon, 24 Sep 2012 10:35:16 -0300 Subject: [PATCH] [#1261] get_key now pulls from $original instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is in reference to issue #1261, where Model->get_key() returns the key from the $attributes instead of from the $original property. This breaks the functionality of a model with a primary key that may change, as the SQL generated will be something like: UPDATE `model` SET `key` = 'new-key' WHERE `key` = 'new-key'; Which won't update the model in the database. --- laravel/database/eloquent/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 306d471a040..e3e71811c8f 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -534,7 +534,7 @@ public function get_dirty() */ public function get_key() { - return $this->get_attribute(static::$key); + return array_get($this->original, static::$key); } /**