From 2b673df15fadc17d6b74132ee9e2c0ef9557314f Mon Sep 17 00:00:00 2001 From: Jan Hartigan Date: Mon, 16 Feb 2015 22:52:10 -0800 Subject: [PATCH 1/2] fixing an odd bug related to setter-field-only models --- changelog.md | 2 ++ src/Frozennode/Administrator/Config/Model/Config.php | 2 +- tests/Config/Model/ModelConfigTest.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 80622256d..858fd6ca9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ ## Changelog +- Bugfix: Strange old bug when using only a setter field on a model + ### 4.16.3 - Bugfix: Adding validateString back into Admin validator to avoid issues with old versions of Laravel diff --git a/src/Frozennode/Administrator/Config/Model/Config.php b/src/Frozennode/Administrator/Config/Model/Config.php index bb5f8684d..5a9503788 100644 --- a/src/Frozennode/Administrator/Config/Model/Config.php +++ b/src/Frozennode/Administrator/Config/Model/Config.php @@ -368,7 +368,7 @@ public function fillModel(&$model, \Illuminate\Http\Request $input, array $field $field->fillModel($model, $input->get($name, NULL)); } //if this is an "external" field (i.e. it's not a column on this model's table) or uneditable, unset it - else + else if ($name !== $model->getKeyName()) { $model->__unset($name); } diff --git a/tests/Config/Model/ModelConfigTest.php b/tests/Config/Model/ModelConfigTest.php index c14df440c..c73077839 100644 --- a/tests/Config/Model/ModelConfigTest.php +++ b/tests/Config/Model/ModelConfigTest.php @@ -312,6 +312,7 @@ public function testFillModel() $model->field_setter = 'field_setter_value'; $model->field_password = ''; $model->shouldReceive('__unset')->times(4); + $model->shouldReceive('getKeyName')->times(2); $fields = array( 'field_external' => $field_external, 'field_uneditable' => $field_uneditable, From 10d406dd3e6c23a2b6530eb8b4b1a1bffbb9e6bb Mon Sep 17 00:00:00 2001 From: Jan Hartigan Date: Mon, 16 Feb 2015 22:52:41 -0800 Subject: [PATCH 2/2] version bump to 4.16.4 --- changelog.md | 1 + readme.md | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 858fd6ca9..e956533dc 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ ## Changelog +### 4.16.4 - Bugfix: Strange old bug when using only a setter field on a model ### 4.16.3 diff --git a/readme.md b/readme.md index 3d956d205..87de36fdd 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ Administrator is an administrative interface builder for [Laravel](http://larave - **Author:** Jan Hartigan - **Website:** [http://frozennode.com](http://administrator.frozennode.com/) -- **Version:** 4.16.3 +- **Version:** 4.16.4 [![Build Status](https://travis-ci.org/FrozenNode/Laravel-Administrator.png?branch=master)](https://travis-ci.org/FrozenNode/Laravel-Administrator) @@ -53,6 +53,9 @@ Administrator is released under the MIT License. See the LICENSE file for detail ## Recent Changelog +### 4.16.4 +- Bugfix: Strange old bug when using only a setter field on a model + ### 4.16.3 - Bugfix: Adding validateString back into Admin validator to avoid issues with old versions of Laravel