From eaa47d896ea45d0997ae9a5965ce4dc137d04aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 19 Jan 2021 20:02:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gii/GiiModel.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Gii/GiiModel.php b/Gii/GiiModel.php index f225b3fb..3012b248 100644 --- a/Gii/GiiModel.php +++ b/Gii/GiiModel.php @@ -158,6 +158,14 @@ class ' . $managerName . ' extends ActiveRecord $over = " " . $val->getDocComment() . "\n"; + $attributes = $val->getAttributes($class); + if (!empty($attributes)) { + foreach ($attributes as $attribute) { + $over .= " + #[" . $attribute->getName() . "('" . implode('\',\'', $attribute->getArguments()) . "')]"; + } + } + $func = $this->getFuncLineContent($class, $classFileName, $val->name) . "\n"; $content[] = $over . $func; @@ -216,6 +224,7 @@ class ' . $managerName . ' extends ActiveRecord * @param $value * @return array|null|bool */ + #[Get(\'' . $field['Field'] . '\')] public function get' . ucfirst($field['Field']) . 'Attribute($value): array|null|bool { $value = stripcslashes($value);