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;