This commit is contained in:
2021-10-19 18:27:12 +08:00
parent 1d1b908c2d
commit bc2b60b42e
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -198,7 +198,9 @@ class ActiveQuery extends Component implements ISqlBuilder
public function all(): Collection|array
{
$data = $this->execute($this->builder->all())->all();
if (!empty($this->with)){
$this->modelClass->setWith($this->with);
}
$collect = new Collection($this, $data, $this->modelClass);
if ($this->asArray) {
return $collect->toArray();
@@ -223,7 +225,6 @@ class ActiveQuery extends Component implements ISqlBuilder
*/
public function getWith(ModelInterface $model): ModelInterface
{
var_dump($this->with);
if (empty($this->with) || !is_array($this->with)) {
return $model;
}
+1 -1
View File
@@ -68,7 +68,7 @@ class CollectionIterator extends \ArrayIterator
if (is_array($current = parent::current())) {
$current = $this->newModel($current);
}
return $this->query->getWith($current);
return $current;
}