File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -33,4 +33,22 @@ public function useWritePdo()
3333
3434 return $ this ;
3535 }
36+
37+ /**
38+ * Add a subselect expression to the query.
39+ *
40+ * @param \Closure|$this|string $query
41+ * @param string $as
42+ * @return $this
43+ *
44+ * @throws \InvalidArgumentException
45+ */
46+ public function selectSub ($ query , $ as )
47+ {
48+ if (get_class ($ query ) == self ::class) {
49+ $ this ->appendCacheTags ($ query ->getCacheTags () ?? []);
50+ }
51+
52+ return parent ::selectSub ($ query , $ as );
53+ }
3654}
Original file line number Diff line number Diff line change @@ -272,6 +272,19 @@ public function cacheTags(array $cacheTags = [])
272272 return $ this ;
273273 }
274274
275+ /**
276+ * Append tags to the cache.
277+ *
278+ * @param array $cacheTags
279+ * @return \Rennokki\QueryCache\Query\Builder
280+ */
281+ public function appendCacheTags (array $ cacheTags = [])
282+ {
283+ $ this ->cacheTags = array_unique (array_merge ($ this ->cacheTags ?? [], $ cacheTags ));
284+
285+ return $ this ;
286+ }
287+
275288 /**
276289 * Use a specific cache driver.
277290 *
You can’t perform that action at this time.
0 commit comments