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