改名
This commit is contained in:
@@ -52,6 +52,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
|
|||||||
* @param $query
|
* @param $query
|
||||||
* @param array $array
|
* @param array $array
|
||||||
* @param null $model
|
* @param null $model
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($query, array $array = [], $model = null)
|
public function __construct($query, array $array = [], $model = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,7 +157,8 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function createAnnotation()
|
public function createAnnotation()
|
||||||
{
|
{
|
||||||
$annotation = Snowflake::app()->getAttributes();
|
$annotation = Snowflake::getAnnotation();
|
||||||
|
$annotation->injectProperty($this);
|
||||||
$methods = $annotation->getMethods(get_called_class());
|
$methods = $annotation->getMethods(get_called_class());
|
||||||
foreach ($methods as $method => $attributes) {
|
foreach ($methods as $method => $attributes) {
|
||||||
foreach ($attributes as $attribute) {
|
foreach ($attributes as $attribute) {
|
||||||
|
|||||||
@@ -39,12 +39,24 @@ class Controller extends HttpService
|
|||||||
/**
|
/**
|
||||||
* Controller constructor.
|
* Controller constructor.
|
||||||
* @param array $config
|
* @param array $config
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($config = [])
|
public function __construct($config = [])
|
||||||
{
|
{
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$annotation = Snowflake::getAnnotation();
|
||||||
|
$annotation->injectProperty($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null|HttpParams $input
|
* @param null|HttpParams $input
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,15 +45,6 @@ class BaseObject implements Configure
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$app = Snowflake::app();
|
|
||||||
if (!($app instanceof Application)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$app->has('attributes')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$attributes = $app->getAttributes();
|
|
||||||
$attributes->injectProperty($this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+12
-1
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Snowflake;
|
namespace Snowflake;
|
||||||
|
|
||||||
|
|
||||||
|
use Annotation\Annotation;
|
||||||
use Exception;
|
use Exception;
|
||||||
use HttpServer\IInterface\Task;
|
use HttpServer\IInterface\Task;
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ class Snowflake
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $port
|
* @param $port
|
||||||
* @return bool|array
|
* @return bool
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function port_already($port): bool
|
public static function port_already($port): bool
|
||||||
@@ -102,6 +103,16 @@ class Snowflake
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Annotation
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getAnnotation(): Annotation
|
||||||
|
{
|
||||||
|
return static::app()->getAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $service
|
* @param $service
|
||||||
* @return string
|
* @return string
|
||||||
|
|||||||
+2
-2
@@ -65,7 +65,7 @@ if (!function_exists('annotation')) {
|
|||||||
*/
|
*/
|
||||||
function annotation(): Annotation
|
function annotation(): Annotation
|
||||||
{
|
{
|
||||||
return Snowflake::app()->getAttributes();
|
return Snowflake::getAnnotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ if (!function_exists('recursive_directory')) {
|
|||||||
*/
|
*/
|
||||||
function recursive_callback(DirectoryIterator $file)
|
function recursive_callback(DirectoryIterator $file)
|
||||||
{
|
{
|
||||||
$attributes = Snowflake::app()->getAttributes();
|
$attributes = Snowflake::getAnnotation();
|
||||||
|
|
||||||
$annotations = $attributes->getFilename($file->getRealPath());
|
$annotations = $attributes->getFilename($file->getRealPath());
|
||||||
if (empty($annotations)) {
|
if (empty($annotations)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user