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
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
#[\Attribute(\Attribute::TARGET_METHOD)] class Set extends Attribute
{
/**
* Set constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param array $handler
* @return ActiveRecord
*/
public function execute(array $handler): ActiveRecord
{
/** @var ActiveRecord $activeRecord */
[$activeRecord, $method] = $handler;
return $activeRecord->addSets($this->name, $method);
}
}