From 6936b5cc8fe1a4b0573236fb691b66a112eca042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 30 Nov 2021 15:10:01 +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 --- src/Base/Model.php | 12 ++++++------ src/Connection.php | 2 +- src/DatabasesProviders.php | 2 +- src/{Annotation => Note}/Get.php | 6 +++--- src/{Annotation => Note}/Relation.php | 6 +++--- src/{Annotation => Note}/Set.php | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) rename src/{Annotation => Note}/Get.php (80%) rename src/{Annotation => Note}/Relation.php (86%) rename src/{Annotation => Note}/Set.php (91%) diff --git a/src/Base/Model.php b/src/Base/Model.php index bc67f3f..203eaba 100644 --- a/src/Base/Model.php +++ b/src/Base/Model.php @@ -221,7 +221,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T */ public function init() { - $an = Kiri::app()->getAnnotation(); + $an = Kiri::app()->getNote(); $an->injectProperty($this); } @@ -682,8 +682,8 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T */ public function getAttribute(string $name) { - if ($this->hasAnnotation($name)) { - return $this->runAnnotation($name, $this->_attributes[$name]); + if ($this->hasNote($name)) { + return $this->runNote($name, $this->_attributes[$name]); } return $this->_attributes[$name] ?? null; } @@ -695,7 +695,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T * @param string $type * @return mixed */ - protected function runAnnotation(string $name, mixed $value, string $type = self::GET): mixed + protected function runNote(string $name, mixed $value, string $type = self::GET): mixed { return call_user_func($this->_annotations[$type][$name], $value); } @@ -922,7 +922,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T * @param string $type * @return array */ - protected function getAnnotation(string $type = self::GET): array + protected function getNote(string $type = self::GET): array { return $this->_annotations[$type] ?? []; } @@ -933,7 +933,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T * @param string $type * @return bool */ - protected function hasAnnotation($name, string $type = self::GET): bool + protected function hasNote($name, string $type = self::GET): bool { if (!isset($this->_annotations[$type])) { return false; diff --git a/src/Connection.php b/src/Connection.php index f5032cf..4aa2a13 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Database; -use Annotation\Inject; +use Note\Inject; use Database\Affair\BeginTransaction; use Database\Affair\Commit; use Database\Affair\Rollback; diff --git a/src/DatabasesProviders.php b/src/DatabasesProviders.php index 5ba79ce..85cb65a 100644 --- a/src/DatabasesProviders.php +++ b/src/DatabasesProviders.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Database; -use Annotation\Inject; +use Note\Inject; use Exception; use Kiri\Abstracts\Config; use Kiri\Abstracts\Providers; diff --git a/src/Annotation/Get.php b/src/Note/Get.php similarity index 80% rename from src/Annotation/Get.php rename to src/Note/Get.php index e1c6e68..c902c6f 100644 --- a/src/Annotation/Get.php +++ b/src/Note/Get.php @@ -1,7 +1,7 @@