Skip to content

Commit 2275449

Browse files
committed
fix bug
1 parent 1e760fe commit 2275449

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/ActiveQuery.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function prepare()
133133
*/
134134
public function all($db = null)
135135
{
136-
return parent::all($db);
136+
return parent::all($db === null ? $this->modelClass::GetDb() : null);
137137
}
138138

139139
/**
@@ -146,7 +146,7 @@ public function all($db = null)
146146
*/
147147
public function one($db = null)
148148
{
149-
$row = parent::one($db);
149+
$row = parent::one($db === null ? $this->modelClass::GetDb() : null);
150150
if ($row !== false) {
151151
$models = $this->populate([$row]);
152152
return reset($models) ?: null;
@@ -167,7 +167,7 @@ public function one($db = null)
167167
*/
168168
public function modify($update, $options = [], $db = null)
169169
{
170-
$row = parent::modify($update, $options, $db);
170+
$row = parent::modify($update, $options, $db === null ? $this->modelClass::GetDb() : null);
171171
if ($row !== null) {
172172
$models = $this->populate([$row]);
173173
return reset($models) ?: null;
@@ -183,12 +183,11 @@ public function modify($update, $options = [], $db = null)
183183
public function getCollection($db = null)
184184
{
185185
/* @var $modelClass ActiveRecord */
186-
$modelClass = $this->modelClass;
187186
if ($db === null) {
188-
$db = $modelClass::getDb();
187+
$db = $this->modelClass::getDb();
189188
}
190189
if ($this->from === null) {
191-
$this->from = $modelClass::collectionName();
190+
$this->from = $this->modelClass::collectionName();
192191
}
193192

194193
return $db->getCollection($this->from);

0 commit comments

Comments
 (0)