Files
kiri-core/Annotation/Model/Set.php
T

38 lines
541 B
PHP
Raw Normal View History

2021-03-03 18:35:04 +08:00
<?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);
}
}