Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Stache/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function getCountForPagination()

protected function getItems($keys)
{
return $this->store->getItems($keys);
return $this->store->getItems($keys)->filter()->values();
}

protected function filterWhereBasic($values, $where)
Expand Down
15 changes: 15 additions & 0 deletions tests/Stache/Repositories/EntryRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ public function it_gets_all_entries()
], $entries->map->id()->sort()->values()->all());
}

#[Test]
public function it_ignores_keys_in_indexes_that_no_longer_have_corresponding_files()
{
$store = $this->stache->store('entries')->store('alphabetical');

$store->index('title')->load();
(function () {
$this->paths = $this->paths()->forget('alphabetical-bravo');
})->call($store);

$entries = $this->repo->query()->whereIn('title', ['Alpha', 'Bravo', 'Zulu'])->get();

$this->assertEquals(['alphabetical-alpha', 'alphabetical-zulu'], $entries->map->id()->all());
}

#[Test]
public function it_gets_entries_from_a_collection()
{
Expand Down
Loading