Fix: propagate connection override to Builder from BaseModel (#58)
This commit is contained in:
+1
-1
@@ -319,7 +319,7 @@ class BaseModel
|
||||
|
||||
protected function newQuery(): Builder
|
||||
{
|
||||
return new Builder($this->getThisClient());
|
||||
return new Builder($this->getThisClient(), $this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-1
@@ -31,10 +31,13 @@ class Builder extends BaseBuilder
|
||||
*/
|
||||
protected $connection = Connection::DEFAULT_NAME;
|
||||
|
||||
public function __construct(?Client $client = null)
|
||||
public function __construct(?Client $client = null, ?string $connection = null)
|
||||
{
|
||||
$this->grammar = new Grammar();
|
||||
$this->client = $client ?? $this->getThisClient();
|
||||
if ($connection !== null) {
|
||||
$this->connection = $connection;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user