From a459cd300da6ca4f940eb7d981e35f83c0ae3a8d Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Wed, 2 Jul 2025 16:08:23 +0900 Subject: [PATCH] dbms_init...1 --- app/Models/CommonModel.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index 16ffe5e..68ec88c 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -110,6 +110,9 @@ abstract class CommonModel extends Model // create, modify 직전 작업용 작업 protected function convertEntityData(string $action, string $field, array $formDatas, mixed $entity): mixed { + if (!array_key_exists($field, $formDatas)) { + return $entity; + } switch ($field) { case $this->getPKField(): // $formDatas에 전달된 값이 없는 경우 @@ -133,9 +136,7 @@ abstract class CommonModel extends Model $entity->$field = htmlentities($formDatas[$field], ENT_QUOTES); break; default: - if (array_key_exists($field, $formDatas)) { - $entity->$field = $formDatas[$field]; - } + $entity->$field = $formDatas[$field]; break; } return $entity;