diff --git a/extend/catcher/traits/db/BaseOptionsTrait.php b/extend/catcher/traits/db/BaseOptionsTrait.php index c29c33c..c22d628 100644 --- a/extend/catcher/traits/db/BaseOptionsTrait.php +++ b/extend/catcher/traits/db/BaseOptionsTrait.php @@ -3,9 +3,7 @@ declare(strict_types=1); namespace catcher\traits\db; -use catcher\CatchModelCollection; use catcher\Utils; -use think\Collection; trait BaseOptionsTrait { @@ -189,25 +187,4 @@ trait BaseOptionsTrait return $model->save(); } - - /** - * rewrite collection - * - * @time 2020年10月20日 - * @param array|iterable $collection - * @param string|null $resultSetType - * @return CatchModelCollection|mixed - */ - public function toCollection(iterable $collection = [], string $resultSetType = null): Collection - { - $resultSetType = $resultSetType ?: $this->resultSetType; - - if ($resultSetType && false !== strpos($resultSetType, '\\')) { - $collection = new $resultSetType($collection); - } else { - $collection = new CatchModelCollection($collection); - } - - return $collection; - } } diff --git a/extend/catcher/traits/db/RewriteTrait.php b/extend/catcher/traits/db/RewriteTrait.php index 8dfc628..add12ce 100644 --- a/extend/catcher/traits/db/RewriteTrait.php +++ b/extend/catcher/traits/db/RewriteTrait.php @@ -1,6 +1,9 @@ resultSetType; + + if ($resultSetType && false !== strpos($resultSetType, '\\')) { + $collection = new $resultSetType($collection); + } else { + $collection = new CatchModelCollection($collection); + } + + return $collection; + } } \ No newline at end of file