fixed empty result in findByPk list

This commit is contained in:
Carsten Brandt
2013-09-30 15:39:04 +02:00
parent b95c056b02
commit 179618c6e9
2 changed files with 10 additions and 3 deletions

View File

@@ -315,9 +315,12 @@ class ActiveQuery extends \yii\base\Component
foreach($pks as $pk) {
if (++$i > $start && ($this->limit === null || $i <= $start + $this->limit)) {
$key = $modelClass::tableName() . ':a:' . $modelClass::buildKey($pk);
$data[] = $db->executeCommand('HGETALL', array($key));
if ($type === 'One' && $this->orderBy === null) {
break;
$result = $db->executeCommand('HGETALL', array($key));
if (!empty($result)) {
$data[] = $result;
if ($type === 'One' && $this->orderBy === null) {
break;
}
}
}
}