diff --git a/src/Illuminate/Database/Eloquent/Collection.php b/src/Illuminate/Database/Eloquent/Collection.php index b87315ebc16..e2f44a5ca61 100755 --- a/src/Illuminate/Database/Eloquent/Collection.php +++ b/src/Illuminate/Database/Eloquent/Collection.php @@ -48,7 +48,7 @@ public function load($relations) $relations = func_get_args(); } - $query = $this->first()->newQuery()->with($relations); + $query = $this->first()->newQueryWithoutRelationships()->with($relations); $this->items = $query->eagerLoadRelations($this->items); } diff --git a/tests/Database/DatabaseEloquentCollectionTest.php b/tests/Database/DatabaseEloquentCollectionTest.php index 4354e06a09d..99344c437c9 100755 --- a/tests/Database/DatabaseEloquentCollectionTest.php +++ b/tests/Database/DatabaseEloquentCollectionTest.php @@ -156,7 +156,7 @@ public function testLoadMethodEagerLoadsGivenRelationships() $c = $this->getMockBuilder('Illuminate\Database\Eloquent\Collection')->setMethods(['first'])->setConstructorArgs([['foo']])->getMock(); $mockItem = m::mock('stdClass'); $c->expects($this->once())->method('first')->will($this->returnValue($mockItem)); - $mockItem->shouldReceive('newQuery')->once()->andReturn($mockItem); + $mockItem->shouldReceive('newQueryWithoutRelationships')->once()->andReturn($mockItem); $mockItem->shouldReceive('with')->with(['bar', 'baz'])->andReturn($mockItem); $mockItem->shouldReceive('eagerLoadRelations')->once()->with(['foo'])->andReturn(['results']); $c->load('bar', 'baz');