改名
This commit is contained in:
@@ -181,7 +181,7 @@ class ActiveQuery extends Component
|
||||
*/
|
||||
public function page(int $size, callable $callback): Pagination
|
||||
{
|
||||
$pagination = objectPool(Pagination::class, [$this]);
|
||||
$pagination = new Pagination($this);
|
||||
$pagination->setOffset(0);
|
||||
$pagination->setLimit($size);
|
||||
$pagination->setCallback($callback);
|
||||
@@ -207,7 +207,7 @@ class ActiveQuery extends Component
|
||||
public function all(): Collection|array
|
||||
{
|
||||
$data = $this->modelClass::getDb()->createCommand($this->queryBuilder())->all();
|
||||
$collect = objectPool(Collection::class, [$this, $data, $this->modelClass]);
|
||||
$collect = new Collection($this, $data, $this->modelClass);
|
||||
if ($this->asArray) {
|
||||
return $collect->toArray();
|
||||
}
|
||||
|
||||
@@ -315,11 +315,6 @@ class ActiveRecord extends BaseActiveRecord
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
$class = $this;
|
||||
Coroutine::defer(function () use ($class) {
|
||||
$object = Snowflake::app()->getObject();
|
||||
$object->release(get_called_class(), $class);
|
||||
});
|
||||
$data = $this->_attributes;
|
||||
foreach ($this->getAnnotation() as $key => $item) {
|
||||
if (!isset($data[$key])) {
|
||||
@@ -327,7 +322,18 @@ class ActiveRecord extends BaseActiveRecord
|
||||
}
|
||||
$data[$key] = call_user_func([$this, $item[1]], $data[$key]);
|
||||
}
|
||||
return array_merge($data, $this->runRelate());
|
||||
$data = array_merge($data, $this->runRelate());
|
||||
$this->recover();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws ComponentException
|
||||
*/
|
||||
public function recover()
|
||||
{
|
||||
objectRecover(get_called_class(), $this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user