diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index 8ca121c..2846391 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -155,12 +155,13 @@ abstract class CommonController extends BaseController $this->setIndexFields($this->getService()->getIndexFields()); $this->setViewFields($this->getService()->getViewFields()); $this->setFilterFields($this->getService()->getFilterFields()); - foreach ($this->getFormFields() as $field) { + foreach ($this->getViewFields() as $field) { $this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field)); } foreach ($this->getFilterFields() as $field) { - $this->setFilterFieldOption($field, $this->getFormFieldOption($field, $this->getFilterFieldOptions())); + $this->setFilterFieldOption($field, $this->getFormFieldOption($field)); } + $this->setBatchJobFields($this->getService()->getBatchJobFields()); } protected function getFormFieldRule(string $action, string $field): string { diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index 67ffdf6..7c37c83 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -62,7 +62,7 @@ abstract class CommonModel extends Model { return constant("static::TITLE"); } - final public function getFields(): array + final public function getAllowedFields(): array { return $this->allowedFields; } @@ -180,7 +180,7 @@ abstract class CommonModel extends Model final function create(array $formDatas, mixed $entity): mixed { // Field에 맞는 Validation Rule 재정의 - $this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->allowedFields)); + $this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->getAllowedFields())); LogCollector::debug("입력내용"); LogCollector::debug(var_export($formDatas, true)); foreach (array_keys($formDatas) as $field) { @@ -204,7 +204,7 @@ abstract class CommonModel extends Model final function modify(mixed $entity, array $formDatas): mixed { // Field에 맞는 Validation Rule 재정의 - $this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->allowedFields)); + $this->setValidationRules($this->getFormFieldRules(__FUNCTION__, $this->getAllowedFields())); // 저장하기 전에 데이터 값 변경이 필요한 Field LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 전 내용"); LogCollector::debug(var_export($formDatas, true)); diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index b777cf9..589b8db 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -26,7 +26,7 @@ abstract class CommonService } public function getViewFields(): array { - return $this->getModel()->getFields(); + return $this->getModel()->getAllowedFields(); } final public function __get($name) { diff --git a/app/Traits/MylogTrait.php b/app/Traits/MylogTrait.php index 7bbe881..273dd40 100644 --- a/app/Traits/MylogTrait.php +++ b/app/Traits/MylogTrait.php @@ -24,7 +24,7 @@ trait MylogTrait MyLogService::log("{$entity->getTitle()}를 수정하였습니다."); break; case 'delete': - foreach ($this->getModel()->getFields() as $field) { + foreach ($this->getModel()->getAllowedFields() as $field) { MyLogService::log("{$field}:{$entity->$field}"); } MyLogService::log("{$entity->getTitle()}를 삭제하였습니다.");