Commit 1fdf17b5 by Carsten Brandt

cleanup redis AR

parent dbf733bf
...@@ -270,7 +270,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface ...@@ -270,7 +270,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
/** /**
* Executes a script created by [[LuaScriptBuilder]] * Executes a script created by [[LuaScriptBuilder]]
* @param Connection $db the database connection used to execute the query. * @param Connection|null $db the database connection used to execute the query.
* If this parameter is not given, the `db` application component will be used. * If this parameter is not given, the `db` application component will be used.
* @param string $type the type of the script to generate * @param string $type the type of the script to generate
* @param string $columnName * @param string $columnName
......
...@@ -175,7 +175,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -175,7 +175,7 @@ class ActiveRecord extends BaseActiveRecord
} }
$db = static::getDb(); $db = static::getDb();
$n = 0; $n = 0;
foreach (static::fetchPks($condition) as $pk) { foreach (self::fetchPks($condition) as $pk) {
$newPk = $pk; $newPk = $pk;
$pk = static::buildKey($pk); $pk = static::buildKey($pk);
$key = static::keyPrefix() . ':a:' . $pk; $key = static::keyPrefix() . ':a:' . $pk;
...@@ -228,7 +228,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -228,7 +228,7 @@ class ActiveRecord extends BaseActiveRecord
} }
$db = static::getDb(); $db = static::getDb();
$n = 0; $n = 0;
foreach (static::fetchPks($condition) as $pk) { foreach (self::fetchPks($condition) as $pk) {
$key = static::keyPrefix() . ':a:' . static::buildKey($pk); $key = static::keyPrefix() . ':a:' . static::buildKey($pk);
foreach ($counters as $attribute => $value) { foreach ($counters as $attribute => $value) {
$db->executeCommand('HINCRBY', [$key, $attribute, $value]); $db->executeCommand('HINCRBY', [$key, $attribute, $value]);
...@@ -257,7 +257,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -257,7 +257,7 @@ class ActiveRecord extends BaseActiveRecord
{ {
$db = static::getDb(); $db = static::getDb();
$attributeKeys = []; $attributeKeys = [];
$pks = static::fetchPks($condition); $pks = self::fetchPks($condition);
$db->executeCommand('MULTI'); $db->executeCommand('MULTI');
foreach ($pks as $pk) { foreach ($pks as $pk) {
$pk = static::buildKey($pk); $pk = static::buildKey($pk);
......
...@@ -65,7 +65,6 @@ class Connection extends Component ...@@ -65,7 +65,6 @@ class Connection extends Component
* @var float timeout to use for redis socket when reading and writing data. If not set the php default value will be used. * @var float timeout to use for redis socket when reading and writing data. If not set the php default value will be used.
*/ */
public $dataTimeout = null; public $dataTimeout = null;
/** /**
* @var array List of available redis commands http://redis.io/commands * @var array List of available redis commands http://redis.io/commands
*/ */
...@@ -215,6 +214,7 @@ class Connection extends Component ...@@ -215,6 +214,7 @@ class Connection extends Component
*/ */
private $_socket; private $_socket;
/** /**
* Closes the connection when this component is being serialized. * Closes the connection when this component is being serialized.
* @return array * @return array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment