Revert "改名"
This reverts commit fdf58326
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Database\Annotation;
|
||||
|
||||
|
||||
use Attribute;
|
||||
use Database\Base\Getter;
|
||||
use Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class Get
|
||||
* @package Annotation\Model
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Annotation\Attribute
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Get constructor.
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct(public string $name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param static $params
|
||||
* @param mixed $class
|
||||
* @param mixed|null $method
|
||||
* @return bool
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
di(Getter::class)->addGetter($this->name, $class, $method);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Database\Annotation;
|
||||
|
||||
|
||||
use Kiri\Annotation\Attribute;
|
||||
use Database\Base\Relate;
|
||||
use Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 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 mixed $class
|
||||
* @param mixed|null $method
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
di(Relate::class)->addRelate($this->name, $class, $method);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Database\Annotation;
|
||||
|
||||
|
||||
use Kiri\Annotation\Attribute;
|
||||
use Database\Base\Setter;
|
||||
use Exception;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_METHOD)] class Set extends Attribute
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Set constructor.
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct(public string $name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param static $params
|
||||
* @param mixed $class
|
||||
* @param mixed|null $method
|
||||
* @return bool
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
di(Setter::class)->addSetter($this->name, $class, $method);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user