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:
Daniele Alessandri
2013-11-09 19:28:40 +01:00
parent 62f8730f1a
commit de02c81398
3 changed files with 27 additions and 1 deletions
@@ -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)) {
+16
View File
@@ -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.
*
+10
View File
@@ -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
*/