Skip to content

Commit 10a7c76

Browse files
committed
added GroupedSelection::refreshData()
1 parent fb2a02b commit 10a7c76

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Database/Table/GroupedSelection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ public function order(string $columns, ...$params): static
8383
}
8484

8585

86+
public function refreshData(): void
87+
{
88+
unset($this->refCache['referencing'][$this->getGeneralCacheKey()][$this->getSpecificCacheKey()]);
89+
$this->data = $this->rows = null;
90+
}
91+
92+
8693
/********************* aggregations ****************d*g**/
8794

8895

tests/Database/Explorer/GroupedSelection.insert().phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ test('grouped selection insert increases count', function () use ($explorer) {
2525
Assert::same(3, $book->related('book_tag')->count('*'));
2626

2727
$book->related('book_tag')->where('tag_id', 23)->delete();
28+
29+
Assert::same(3, $book->related('book_tag')->count());
30+
$book->related('book_tag')->refreshData();
31+
Assert::same(2, $book->related('book_tag')->count());
2832
});
2933

3034

0 commit comments

Comments
 (0)