dep: package update
This commit is contained in:
+24
@@ -161,6 +161,13 @@ class Connection implements ConnectionInterface
|
||||
*/
|
||||
protected $pretending = false;
|
||||
|
||||
/**
|
||||
* All of the callbacks that should be invoked before a query is executed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $beforeExecutingCallbacks = [];
|
||||
|
||||
/**
|
||||
* The instance of Doctrine connection.
|
||||
*
|
||||
@@ -641,6 +648,10 @@ class Connection implements ConnectionInterface
|
||||
*/
|
||||
protected function run($query, $bindings, Closure $callback)
|
||||
{
|
||||
foreach ($this->beforeExecutingCallbacks as $beforeExecutingCallback) {
|
||||
$beforeExecutingCallback($query, $bindings, $this);
|
||||
}
|
||||
|
||||
$this->reconnectIfMissingConnection();
|
||||
|
||||
$start = microtime(true);
|
||||
@@ -807,6 +818,19 @@ class Connection implements ConnectionInterface
|
||||
$this->setPdo(null)->setReadPdo(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a hook to be run just before a database query is executed.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function beforeExecuting(Closure $callback)
|
||||
{
|
||||
$this->beforeExecutingCallbacks[] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a database query listener with the connection.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user