Files
kiri-databases/src/Annotation/Relation.php
T

46 lines
794 B
PHP
Raw Normal View History

2021-08-17 16:22:18 +08:00
<?php
namespace Database\Annotation;
use Annotation\Attribute;
use Database\ActiveRecord;
use Database\Base\Relate;
use Exception;
use JetBrains\PhpStorm\Pure;
use Kiri\Kiri;
/**
* Class Relation
* @package Annotation\Model
*/
#[\Attribute(\Attribute::TARGET_METHOD)] class Relation extends Attribute
{
2021-08-29 04:06:48 +08:00
/**
* Relation constructor.
* @param string $name
*/
public function __construct(string $name)
{
}
/**
* @param static $params
* @param mixed $class
* @param mixed|null $method
* @return bool
* @throws Exception
*/
public static function execute(mixed $params, mixed $class, mixed $method = null): bool
{
di(Relate::class)->addRelate($class, $params->name, $method);
2021-08-17 16:22:18 +08:00
return true;
2021-08-29 04:06:48 +08:00
}
2021-08-17 16:22:18 +08:00
}