From 73e3d56aaa17fd13bd677b798fbed2a53dea1142 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Wed, 2 Jul 2025 13:21:18 +0900 Subject: [PATCH] dbms_init...1 --- app/Controllers/Admin/UserController.php | 1 - app/Models/CommonModel.php | 15 ++++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index 9bd5ab8..0f5d817 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -91,7 +91,6 @@ class UserController extends AdminController ]; // $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : "")); $this->initAction(__FUNCTION__, $fields); - $this->setFormFields($this->getService()->getFormFields()); //FieldRule정의 foreach ($this->getFormFields() as $field) { $this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field)); diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index 437d234..2d040c6 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -80,13 +80,6 @@ abstract class CommonModel extends Model $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // variant 10 return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } - final protected function getFormFieldRules(string $action, array $fields, $rules = []): array - { - foreach ($fields as $field) { - $rules[$field] = $this->getFormFieldRule($action, $field); - } - return $rules; - } public function getFormFieldRule(string $action, string $field): string { if (is_array($field)) { @@ -181,11 +174,11 @@ abstract class CommonModel extends Model public function create(array $formDatas, mixed $entity): mixed { - // Field에 맞는 Validation Rule 재정의 - $this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->getAllowedFields())); LogCollector::debug("입력내용"); LogCollector::debug(var_export($formDatas, true)); foreach (array_keys($formDatas) as $field) { + // Field에 맞는 Validation Rule 재정의 + $this->setValidationRule($field, $this->getFormFieldRule(__FUNCTION__, $field)); $entity = $this->convertEntityData(__FUNCTION__, $field, $formDatas, $entity); } // primaryKey가 자동입력이 아니면 @@ -205,13 +198,13 @@ abstract class CommonModel extends Model } final public function modify(mixed $entity, array $formDatas): mixed { - // Field에 맞는 Validation Rule 재정의 - $this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->getAllowedFields())); // 저장하기 전에 데이터 값 변경이 필요한 Field LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 전 내용"); LogCollector::debug(var_export($formDatas, true)); LogCollector::debug(var_export($entity->toArray(), true)); foreach (array_keys($formDatas) as $field) { + // Field에 맞는 Validation Rule 재정의 + $this->setValidationRule($field, $this->getFormFieldRule(__FUNCTION__, $field)); $entity = $this->convertEntityData(__FUNCTION__, $field, $formDatas, $entity); } //수정일추가