This commit is contained in:
2021-03-02 17:30:52 +08:00
parent 5474447ca4
commit a703a9011a
2 changed files with 885 additions and 881 deletions
+4
View File
@@ -132,6 +132,10 @@ class Annotation extends Component
*/
private function resolveMethod(ReflectionClass $reflect, $class, $alias, $object)
{
$targets = $reflect->getAttributes(Target::class);
if (empty($targets)) {
return;
}
foreach ($reflect->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
if ($method->class != $class) {
continue;
+4 -4
View File
@@ -112,9 +112,6 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
} else {
$this->_relation = Context::getContext(Relation::class);
}
$this->_fields = static::getColumns()->format();
$this->createAnnotation();
}
@@ -663,8 +660,11 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
* @return bool
* @throws Exception
*/
#[Pure] public function has($attribute): bool
public function has($attribute): bool
{
if (empty($this->_fields)) {
$this->_fields = static::getColumns()->format();
}
return array_key_exists($attribute, $this->_fields);
}