改名
This commit is contained in:
+3
-2
@@ -198,7 +198,9 @@ class ActiveQuery extends Component implements ISqlBuilder
|
|||||||
public function all(): Collection|array
|
public function all(): Collection|array
|
||||||
{
|
{
|
||||||
$data = $this->execute($this->builder->all())->all();
|
$data = $this->execute($this->builder->all())->all();
|
||||||
|
if (!empty($this->with)){
|
||||||
|
$this->modelClass->setWith($this->with);
|
||||||
|
}
|
||||||
$collect = new Collection($this, $data, $this->modelClass);
|
$collect = new Collection($this, $data, $this->modelClass);
|
||||||
if ($this->asArray) {
|
if ($this->asArray) {
|
||||||
return $collect->toArray();
|
return $collect->toArray();
|
||||||
@@ -223,7 +225,6 @@ class ActiveQuery extends Component implements ISqlBuilder
|
|||||||
*/
|
*/
|
||||||
public function getWith(ModelInterface $model): ModelInterface
|
public function getWith(ModelInterface $model): ModelInterface
|
||||||
{
|
{
|
||||||
var_dump($this->with);
|
|
||||||
if (empty($this->with) || !is_array($this->with)) {
|
if (empty($this->with) || !is_array($this->with)) {
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class CollectionIterator extends \ArrayIterator
|
|||||||
if (is_array($current = parent::current())) {
|
if (is_array($current = parent::current())) {
|
||||||
$current = $this->newModel($current);
|
$current = $this->newModel($current);
|
||||||
}
|
}
|
||||||
return $this->query->getWith($current);
|
return $current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user