Skip to content

Commit 6d8f07f

Browse files
authored
check for method
1 parent c1c766d commit 6d8f07f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Connect/Connection.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ public function getSchemaBuilder()
3232
*/
3333
protected function getDefaultQueryGrammar()
3434
{
35-
return $this->withTablePrefix((new Query\Grammar)->setConnection($this));
35+
$grammar = new Query\Grammar;
36+
if (method_exists($grammar, 'setConnection')) {
37+
$grammar->setConnection($this);
38+
}
39+
return $this->withTablePrefix($grammar);
3640
}
3741

3842
/**
@@ -42,7 +46,11 @@ protected function getDefaultQueryGrammar()
4246
*/
4347
protected function getDefaultSchemaGrammar()
4448
{
45-
return $this->withTablePrefix((new Schema\Grammar)->setConnection($this));
49+
$grammar = new Schema\Grammar;
50+
if (method_exists($grammar, 'setConnection')) {
51+
$grammar->setConnection($this);
52+
}
53+
return $this->withTablePrefix($grammar);
4654
}
4755

4856
/**

0 commit comments

Comments
 (0)