useMaster() public method
Executes the provided callback by using the master connection.
This method is provided so that you can temporarily force using the master connection to perform DB operations even if they are read queries. For example,
$result = $db->useMaster(function ($db) { return $db->createCommand('SELECT * FROM user LIMIT 1')->queryOne(); });
public mixed useMaster ( callable $callback ) | ||
---|---|---|
$callback | callable |
A PHP callable to be executed by this method. Its signature is |
return | mixed |
The return value of the callback |
Please login to continue.