改名
This commit is contained in:
@@ -275,11 +275,11 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
$data = $this->_attributes;
|
$data = $this->_attributes;
|
||||||
foreach ($this->getAnnotation() as $key => $item) {
|
foreach ($this->getAnnotation('get') as $key => $item) {
|
||||||
if (!isset($data[$key])) {
|
if (!isset($data[$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$data[$key] = call_user_func([$this, $item[1]], $data[$key]);
|
$data[$key] = call_user_func($item, $data[$key]);
|
||||||
}
|
}
|
||||||
$data = array_merge($data, $this->runRelate());
|
$data = array_merge($data, $this->runRelate());
|
||||||
$this->recover();
|
$this->recover();
|
||||||
|
|||||||
@@ -820,11 +820,12 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $type
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getAnnotation(): array
|
protected function getAnnotation($type = 'get'): array
|
||||||
{
|
{
|
||||||
return $this->_annotations;
|
return $this->_annotations[$type] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user