From ce512a65aa35a2c722042da42057397dc140c50a Mon Sep 17 00:00:00 2001 From: Koss Date: Wed, 17 Dec 2014 10:38:01 +0200 Subject: [PATCH 1/2] [4.2] Fixed Query\Builder call to undefined method hasGetMutator when using lists method. When using lists method in Query\Builder: Call to undefined method Illuminate\Database\Query\Builder::hasGetMutator(). Need new method getMutatorMethod Proposed changes fix issue. --- src/Illuminate/Database/Eloquent/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php index 9d017cff5968..7ef9ac109d3c 100755 --- a/src/Illuminate/Database/Eloquent/Builder.php +++ b/src/Illuminate/Database/Eloquent/Builder.php @@ -212,7 +212,7 @@ public function lists($column, $key = null) // If the model has a mutator for the requested column, we will spin through // the results and mutate the values so that the mutated version of these // columns are returned as you would expect from these Eloquent models. - if ($this->model->hasGetMutator($column)) + if ($this->model->getMutatorMethod($column)) { foreach ($results as $key => &$value) { From d8fe217eb89ecb41c629194c4db4edb0d379f933 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Wed, 17 Dec 2014 11:29:25 +0200 Subject: [PATCH 2/2] Fix test replace hasGetMutator to getMutatorMethod --- tests/Database/DatabaseEloquentBuilderTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Database/DatabaseEloquentBuilderTest.php b/tests/Database/DatabaseEloquentBuilderTest.php index f60988ae6ae1..2b2d377673bf 100755 --- a/tests/Database/DatabaseEloquentBuilderTest.php +++ b/tests/Database/DatabaseEloquentBuilderTest.php @@ -175,7 +175,7 @@ public function testListsReturnsTheMutatedAttributesOfAModel() $builder = $this->getBuilder(); $builder->getQuery()->shouldReceive('lists')->with('name', '')->andReturn(array('bar', 'baz')); $builder->setModel($this->getMockModel()); - $builder->getModel()->shouldReceive('hasGetMutator')->with('name')->andReturn(true); + $builder->getModel()->shouldReceive('getMutatorMethod')->with('name')->andReturn(true); $builder->getModel()->shouldReceive('newFromBuilder')->with(array('name' => 'bar'))->andReturn(new EloquentBuilderTestListsStub(array('name' => 'bar'))); $builder->getModel()->shouldReceive('newFromBuilder')->with(array('name' => 'baz'))->andReturn(new EloquentBuilderTestListsStub(array('name' => 'baz'))); @@ -188,7 +188,7 @@ public function testListsWithoutModelGetterJustReturnTheAttributesFoundInDatabas $builder = $this->getBuilder(); $builder->getQuery()->shouldReceive('lists')->with('name', '')->andReturn(array('bar', 'baz')); $builder->setModel($this->getMockModel()); - $builder->getModel()->shouldReceive('hasGetMutator')->with('name')->andReturn(false); + $builder->getModel()->shouldReceive('getMutatorMethod')->with('name')->andReturn(false); $this->assertEquals(array('bar', 'baz'), $builder->lists('name')); }