mirror of
https://github.com/predis/predis.git
synced 2026-09-18 14:28:54 +00:00
Deprecate Predis\Client::multiExec().
This method will be replaced by Predis\Client::transaction() in the next major release of Predis.
This commit is contained in:
@@ -33,7 +33,7 @@ function zpop($client, $key)
|
||||
// which the client bails out with an exception.
|
||||
);
|
||||
|
||||
$client->multiExec($options, function ($tx) use ($key, &$element) {
|
||||
$client->transaction($options, function ($tx) use ($key, &$element) {
|
||||
@list($element) = $tx->zrange($key, 0, 0);
|
||||
|
||||
if (isset($element)) {
|
||||
@@ -369,6 +369,10 @@ class Client implements ClientInterface
|
||||
* Creates a new transaction context and returns it, or returns the results of
|
||||
* a transaction executed inside the optionally provided callable object.
|
||||
*
|
||||
* @deprecated You should start using the new Client::transaction() method
|
||||
* as it will replace Client::multiExec() in the next major
|
||||
* version of the library.
|
||||
*
|
||||
* @param mixed $arg,... Options for the context, a callable object, or both.
|
||||
* @return MultiExecContext|array
|
||||
*/
|
||||
@@ -377,6 +381,18 @@ class Client implements ClientInterface
|
||||
return $this->sharedInitializer(func_get_args(), 'initMultiExec');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new transaction context and returns it, or returns the results of
|
||||
* a transaction executed inside the optionally provided callable object.
|
||||
*
|
||||
* @param mixed $arg,... Options for the context, a callable object, or both.
|
||||
* @return MultiExecContext|array
|
||||
*/
|
||||
public function transaction(/* arguments */)
|
||||
{
|
||||
return $this->sharedInitializer(func_get_args(), 'initMultiExec');
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction context initializer.
|
||||
*
|
||||
|
||||
@@ -654,6 +654,16 @@ class ClientTest extends StandardTestCase
|
||||
$this->assertInstanceOf('Predis\Transaction\MultiExecContext', $client->multiExec());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testMethodTransactionIsAliasForMethodMultiExec()
|
||||
{
|
||||
$client = new Client();
|
||||
|
||||
$this->assertInstanceOf('Predis\Transaction\MultiExecContext', $client->transaction());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user