This commit is contained in:
2021-03-03 18:35:04 +08:00
parent 1c6cde4133
commit c337280d4e
25 changed files with 533 additions and 499 deletions
+6 -11
View File
@@ -5,18 +5,15 @@ namespace Annotation\Model;
use Annotation\Annotation;
use Annotation\IAnnotation;
use Attribute;
use Database\ActiveRecord;
use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake;
/**
* Class Get
* @package Annotation\Model
*/
#[Attribute(Attribute::TARGET_METHOD)] class Get implements IAnnotation
#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Annotation\Attribute
{
@@ -33,16 +30,14 @@ use Snowflake\Snowflake;
/**
* @param array $handler
* @return Annotation
* @throws ComponentException
* @return ActiveRecord
*/
public function execute(array $handler): Annotation
public function execute(array $handler): ActiveRecord
{
// TODO: Implement execute() method.
$annotation = Snowflake::app()->getAttributes();
$annotation->addMethodAttribute($handler, $this->name);
/** @var ActiveRecord $activeRecord */
[$activeRecord, $method] = $handler;
return $annotation;
return $activeRecord->addGets($this->name, $method);
}