This commit is contained in:
2021-01-19 19:13:27 +08:00
parent dab9fae0f0
commit 9060220b21
2 changed files with 8 additions and 5 deletions
+4 -4
View File
@@ -310,14 +310,14 @@ class ActiveRecord extends BaseActiveRecord
*/
public function toArray(): array
{
$data = [];
$attributes = Snowflake::app()->getAttributes();
$callback = $attributes->getByClass(static::class);
var_dump($callback);
foreach ($this->_attributes as $key => $val) {
$data[$key] = $this->getAttribute($key);
$data = $this->_attributes;
foreach ($callback as $key => $item) {
$data[$key] = call_user_func($item, $data[$key]);
}
return array_merge($data, $this->runRelate());
}