File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
tests/Database/Table/bugs Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -538,6 +538,7 @@ protected function emptyResultSet($saveCache = TRUE)
538538 $ this ->specificCacheKey = NULL ;
539539 $ this ->generalCacheKey = NULL ;
540540 $ this ->refCache ['referencingPrototype ' ] = [];
541+ $ this ->refCache ['referenced ' ] = [];
541542 }
542543
543544
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * @dataProvider? ../../databases.ini
5+ */
6+
7+ use Tester \Assert ;
8+
9+ require __DIR__ . '/../../connect.inc.php ' ; // create $connection
10+
11+ Nette \Database \Helpers::loadFromFile ($ connection , __DIR__ . "/../../files/ {$ driverName }-nette_test1.sql " );
12+
13+
14+ test (function () use ($ context ) {
15+ $ selection = $ context ->table ('book ' );
16+ $ selection ->get (2 )->author ->name ; //reading via reference
17+
18+ $ context ->table ('book ' )->get (2 )->author ->update (['name ' => 'New name ' ]);
19+ $ context ->table ('book ' )->get (2 )->update (['title ' => 'New book title ' ]);
20+
21+ $ selection ->limit (NULL ); //should invalidate cache of data and references
22+ $ book = $ selection ->get (2 );
23+
24+ Assert::same ('New book title ' , $ book ->title ); //data cache invalidated
25+ Assert::same ('New name ' , $ book ->author ->name ); //references NOT invalidated
26+ });
You can’t perform that action at this time.
0 commit comments