Skip to content

Commit 0b2263f

Browse files
author
Corey McCormick
committed
Fixed in issue where a query would crash - #3
1 parent 34d645b commit 0b2263f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/QueryCacheBuilder.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ public function __construct(QueryCache $cache, ConnectionInterface $connection,
3131
parent::__construct($connection, $grammar, $processor);
3232
}
3333

34+
/**
35+
* Generates a new query.
36+
*
37+
* @return static
38+
*/
39+
public function newQuery()
40+
{
41+
return new static($this->cache, $this->connection, $this->grammar, $this->processor);
42+
}
43+
3444
/**
3545
* Returns the query results.
3646
*

tests/QueryCacheBuilderTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,10 @@ public function dont_remember_disables_caching()
6060

6161
$this->builder->dontRemember();
6262
}
63+
64+
/** @test */
65+
public function new_query_returns_a_new_static()
66+
{
67+
$this->isInstanceOf(QueryCacheBuilder::class, $this->builder->newQuery());
68+
}
6369
}

0 commit comments

Comments
 (0)