改名
This commit is contained in:
@@ -218,13 +218,10 @@ class ActiveQuery extends Component
|
|||||||
*/
|
*/
|
||||||
public function all()
|
public function all()
|
||||||
{
|
{
|
||||||
$data = $this->modelClass::getDb()
|
$collect = new Collection($this,
|
||||||
->createCommand($this->queryBuilder())
|
$this->modelClass::getDb()->createCommand($this->queryBuilder())->all()
|
||||||
->all();
|
, $this->modelClass
|
||||||
|
);
|
||||||
$collect = new Collection($this);
|
|
||||||
$collect->setModel($this->modelClass);
|
|
||||||
$collect->setItems($data);
|
|
||||||
if ($this->asArray) {
|
if ($this->asArray) {
|
||||||
return $collect->toArray();
|
return $collect->toArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,11 +37,13 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
|
|||||||
*
|
*
|
||||||
* @param $query
|
* @param $query
|
||||||
* @param array $array
|
* @param array $array
|
||||||
|
* @param null $model
|
||||||
*/
|
*/
|
||||||
public function __construct($query, array $array = [])
|
public function __construct($query, array $array = [], $model = null)
|
||||||
{
|
{
|
||||||
$this->_item = $array;
|
$this->_item = $array;
|
||||||
$this->query = $query;
|
$this->query = $query;
|
||||||
|
$this->model = $model;
|
||||||
|
|
||||||
parent::__construct([]);
|
parent::__construct([]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class Collection extends AbstractCollection
|
|||||||
}
|
}
|
||||||
$_filters[] = $value;
|
$_filters[] = $value;
|
||||||
}
|
}
|
||||||
return new Collection($this->query, $_filters);
|
return new Collection($this->query, $_filters, $this->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user