This commit is contained in:
2021-02-23 17:19:46 +08:00
parent 21bdf32fc3
commit 31d5024663
10 changed files with 41 additions and 26 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
*/
public function getModel(): ActiveRecord
{
return Snowflake::app()->getObject()->get($this->model, false);
return objectPool($this->model);
}
+1 -2
View File
@@ -898,8 +898,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
*/
public static function populate(array $data): static
{
$object = Snowflake::app()->getObject();
$model = $object->get(static::class);
$model = objectPool(static::class);
$model->setAttributes($data);
$model->setIsCreate(false);
$model->refresh();
+1 -4
View File
@@ -50,10 +50,7 @@ class CollectionIterator extends \ArrayIterator
*/
protected function newModel($current): ActiveRecord
{
$object = Snowflake::app()->getObject();
$model = $object->get($this->model, false);
return $model->setAttributes($current);
return objectPool($this->model)->setAttributes($current);
}