Skip to content

Commit 716531a

Browse files
committed
Fixed eloquent builder "lists()" call.
1 parent fdd571e commit 716531a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Nqxcode/LuceneSearch/Model/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private function groupedSearchableIdsAsKeys(array $hits)
158158
$primaryKey = $model->getKeyName();
159159

160160
if (!method_exists($model, 'searchableIds')) { // If not exists get full id list
161-
$searchableIds = $model->lists($primaryKey);
161+
$searchableIds = $model->newQuery()->lists($primaryKey);
162162
} else {
163163
$searchableIds = $model->{'searchableIds'}();
164164
}

tests/unit/Model/ConfigTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ public function testModels()
194194
list($cKey, $cValue) = $this->config->classUidPair(new DummyModel);
195195
list($pKey, $pValue) = $this->config->primaryKeyPair(new DummyModel);
196196

197-
$this->dummyMock->shouldReceive('lists')->with('pk')->andReturn([1, 2, 3])->byDefault();
197+
$this->dummyMock->shouldReceive('newQuery')->andReturn(
198+
$builderMock = m::mock('Nqxcode\LuceneSearch\Query\Builder')
199+
);
200+
$builderMock->shouldReceive('lists')->with('pk')->andReturn([1, 2, 3])->byDefault();
198201

199202
$hitMock = m::mock('ZendSearch\Lucene\Search\QueryHit');
200203
$hitMock->{$cKey} = $cValue;

0 commit comments

Comments
 (0)