This commit is contained in:
2021-01-19 17:54:45 +08:00
parent 0d2c829b76
commit fc3eba8a23
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ class Annotation extends Component
} }
foreach ($this->_classes[$className] as $_method => $class) { foreach ($this->_classes[$className] as $_method => $class) {
if ($method == $_method) { if ($method == $_method) {
return [$class]; return [$class, $_method];
} }
} }
return []; return [];
+5 -1
View File
@@ -386,7 +386,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess
$lastId = $this->refresh(); $lastId = $this->refresh();
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
$trance->rollback(); $trance->rollback();
$lastId = $this->addError($exception->getMessage(),'mysql'); $lastId = $this->addError($exception->getMessage(), 'mysql');
} }
return $lastId; return $lastId;
} }
@@ -665,6 +665,10 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess
*/ */
public function __get($name): mixed public function __get($name): mixed
{ {
$attributes = Snowflake::app()->getAttributes();
$callback = $attributes->getByClass(static::class, $name);
var_dump($callback);
$method = 'get' . ucfirst($name); $method = 'get' . ucfirst($name);
if (method_exists($this, $method . 'Attribute')) { if (method_exists($this, $method . 'Attribute')) {
return $this->{$method . 'Attribute'}($this->_attributes[$name] ?? null); return $this->{$method . 'Attribute'}($this->_attributes[$name] ?? null);