From 074762cdaed91382dfc958d994a653ced9e0eca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Feb 2021 19:15:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Base/AbstractCollection.php | 9 +++++++++ Database/Base/BaseActiveRecord.php | 4 +--- Database/Base/CollectionIterator.php | 9 +++++++++ Database/Pagination.php | 9 +++++++++ System/Event.php | 8 ++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Database/Base/AbstractCollection.php b/Database/Base/AbstractCollection.php index 1493bf29..5b164ecf 100644 --- a/Database/Base/AbstractCollection.php +++ b/Database/Base/AbstractCollection.php @@ -46,6 +46,15 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat } + /** + * recover class by clone + */ + public function __clone() + { + $this->clean(); + } + + /** * Collection constructor. * diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 4497ec10..e62ee380 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -98,12 +98,10 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess /** - * - * @throws ComponentException + * recover class by clone */ public function __clone() { - $this->error('__clone ' . get_called_class()); $this->clean(); } diff --git a/Database/Base/CollectionIterator.php b/Database/Base/CollectionIterator.php index 220cec04..083ddbae 100644 --- a/Database/Base/CollectionIterator.php +++ b/Database/Base/CollectionIterator.php @@ -33,6 +33,15 @@ class CollectionIterator extends \ArrayIterator } + /** + * recover class by clone + */ + public function __clone() + { + $this->clean(); + } + + /** * CollectionIterator constructor. * @param $model diff --git a/Database/Pagination.php b/Database/Pagination.php index d57cf692..9b885677 100644 --- a/Database/Pagination.php +++ b/Database/Pagination.php @@ -61,6 +61,15 @@ class Pagination extends Component } + /** + * recover class by clone + */ + public function __clone() + { + $this->clean(); + } + + /** * @param array|Closure $callback * @throws Exception diff --git a/System/Event.php b/System/Event.php index 3f522334..288b8826 100644 --- a/System/Event.php +++ b/System/Event.php @@ -171,6 +171,14 @@ class Event extends BaseObject } + /** + * recover class by clone + */ + public function __clone() + { + $this->clean(); + } + /** * @param $name * @param array $params