Files
kiri-core/Annotation/Model/Relation.php
T
as2252258@163.com 8137b24865 modify
2021-05-03 03:48:52 +08:00

42 lines
670 B
PHP

<?php
namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
use JetBrains\PhpStorm\Pure;
use Snowflake\Snowflake;
/**
* Class Relation
* @package Annotation\Model
*/
#[\Attribute(\Attribute::TARGET_METHOD)] class Relation extends Attribute
{
/**
* Relation constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param array $handler
* @return bool
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Snowflake::getAnnotation();
$annotation->addRelate($class::class, $this->name, $method);
return true;
}
}