diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 05c78d2..66dec68 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -215,6 +215,9 @@ abstract class CommonService //수정용 protected function modify_process($entity, array $formDatas): CommonEntity { + $fields = array_keys($formDatas); + $this->getFormService()->setFormFields($fields); + $this->getFormService()->setFormRules('modify', $fields); // 데이터 검증 $this->getFormService()->validate($formDatas); // 2. 폼 데이터를 엔티티에 병합합니다. (fill() 사용) diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 64fd0cc..6900312 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -202,7 +202,7 @@ class ServiceService extends CustomerService } protected function create_process(array $formDatas): ServiceEntity { - //서비스코드생성 + //생성폼에는 없는 필수항목 지정용(code) $formDatas['code'] = $formDatas['site'] . "_s" . uniqid(); //서비스 생성 $entity = parent::create_process($formDatas); @@ -221,6 +221,10 @@ class ServiceService extends CustomerService { //변경전 정보 $oldEntity = clone $entity; + + //수정폼에는 없는 필수항목 지정용(code,amount) + $formDatas['code'] = $entity->getCode(); + $formDatas['amount'] = $entity->getAmount(); //서비스 수정 $entity = parent::modify_process($entity, $formDatas); if (!$entity instanceof ServiceEntity) {