Skip to content

Commit

Permalink
ActiveQuery - added pupulate method
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Apr 8, 2016
1 parent 25859bc commit 314ac7c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ActiveQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,18 @@ public function all($db = null)
return parent::all($db);
}

$result = $this->createCommand($db)->search($this->options);
$rows = $this->createCommand($db)->search($this->options);

if (empty($result)) {
return $this->populate($rows);
}

public function populate($rows)
{
if (empty($rows)) {
return [];
}

$models = $this->createModels($result);
$models = $this->createModels($rows);
if (!empty($this->with)) {
$this->findWith($this->with, $models);
}
Expand Down

0 comments on commit 314ac7c

Please sign in to comment.