This commit is contained in:
2021-04-25 17:01:57 +08:00
parent 4b0e457318
commit c17647859a
5 changed files with 204 additions and 163 deletions
+7 -5
View File
@@ -8,10 +8,6 @@ namespace Database\Base;
use Database\ActiveQuery;
use Database\ActiveRecord;
use Exception;
use ReflectionException;
use Snowflake\Channel;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
/**
@@ -28,6 +24,9 @@ class CollectionIterator extends \ArrayIterator
private ActiveQuery $query;
private ?ActiveRecord $_clone = null;
public function clean()
{
unset($this->query);
@@ -57,7 +56,10 @@ class CollectionIterator extends \ArrayIterator
*/
protected function newModel($current): ActiveRecord
{
return $this->model::populate($current);
$model = clone $this->model;
$model->setAttributes($current);
$model->refresh();
return $model;
}