diff --git a/Annotation/Get.php b/Annotation/Get.php index 8c50876..43fed28 100644 --- a/Annotation/Get.php +++ b/Annotation/Get.php @@ -5,15 +5,14 @@ namespace Database\Annotation; use Attribute; -use Database\Base\Getter; -use Exception; +use Kiri\Annotation\AbstractAttribute; /** * Class Get * @package Annotation\Model */ -#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Kiri\Annotation\AbstractAttribute +#[Attribute(Attribute::TARGET_METHOD)] class Get extends AbstractAttribute { @@ -33,7 +32,6 @@ use Exception; */ public function execute(mixed $class, mixed $method = null): bool { - di(Getter::class)->addGetter($this->name, $class, $method); return true; } diff --git a/Annotation/Relation.php b/Annotation/Relation.php index 9f4250b..a4c2316 100644 --- a/Annotation/Relation.php +++ b/Annotation/Relation.php @@ -5,7 +5,6 @@ namespace Database\Annotation; use Kiri\Annotation\AbstractAttribute; -use Database\Base\Relate; use Exception; @@ -34,7 +33,6 @@ use Exception; */ public function execute(mixed $class, mixed $method = null): bool { - di(Relate::class)->addRelate($this->name, $class, $method); return true; } diff --git a/Annotation/Set.php b/Annotation/Set.php index 2fd0fd9..ee5ec5e 100644 --- a/Annotation/Set.php +++ b/Annotation/Set.php @@ -5,7 +5,6 @@ namespace Database\Annotation; use Kiri\Annotation\AbstractAttribute; -use Database\Base\Setter; use Exception; #[\Attribute(\Attribute::TARGET_METHOD)] class Set extends AbstractAttribute @@ -28,7 +27,6 @@ use Exception; */ public function execute(mixed $class, mixed $method = null): bool { - di(Setter::class)->addSetter($this->name, $class, $method); return true; } diff --git a/Base/Getter.php b/Base/Getter.php index fdcc484..bace46c 100644 --- a/Base/Getter.php +++ b/Base/Getter.php @@ -13,7 +13,7 @@ class Getter * @param $class * @param $method */ - public function addGetter($name, $class, $method) + public function addGetter($name, $class, $method): void { $this->_classMapping[$class][$name] = $method; } diff --git a/Base/Model.php b/Base/Model.php index ffa715c..ea58a50 100644 --- a/Base/Model.php +++ b/Base/Model.php @@ -734,17 +734,6 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T } - /** - * @param $name - * @return array|string|null - * @throws Exception - */ - public function getRelate($name): null|array|string - { - return di(Relate::class)->getRelate(static::class, $name); - } - - /** * @param $attribute * @return bool diff --git a/Model.php b/Model.php index 2d226f3..4b0d4b0 100644 --- a/Model.php +++ b/Model.php @@ -10,15 +10,11 @@ declare(strict_types=1); namespace Database; -use Database\Base\Getter; -use Database\Traits\HasBase; use Exception; use Kiri; use Kiri\Exception\NotFindClassException; -use Kiri\ToArray; use Kiri\Error\StdoutLoggerInterface; use ReflectionException; -use Swoole\Coroutine; defined('SAVE_FAIL') or define('SAVE_FAIL', 3227); defined('FIND_OR_CREATE_MESSAGE') or define('FIND_OR_CREATE_MESSAGE', 'Create a new model, but the data cannot be empty.');