This commit is contained in:
2021-03-29 17:17:02 +08:00
parent 64dee2e797
commit c112fc839c
+12 -5
View File
@@ -36,17 +36,24 @@ class BaseObject implements Configure
if (!empty($config) && is_array($config)) {
Snowflake::configure($this, $config);
}
// $app = Snowflake::app();
// if ($app instanceof Application && $app->has('attributes')) {
// annotation()->injectProperty($this);
// }
$this->init();
}
/**
* @throws Exception
*/
public function init()
{
$app = Snowflake::app();
if (!($app instanceof Application)) {
return;
}
if (!$app->has('attributes')) {
return;
}
$attributes = $app->getAttributes();
$attributes->injectProperty($this);
}