addClassPaths('Client'); } public function getDTOClass(): string { return ClientDTO::class; } public function createDTO(array $formDatas): ClientDTO { return new ClientDTO($formDatas); } public function getEntityClass(): string { return ClientEntity::class; } //기본 기능부분 protected function getEntity_process(mixed $entity): ClientEntity { return $entity; } //List 검색용 //FormFilter 조건절 처리 //검색어조건절처리 //OrderBy 처리 public function setOrderBy(mixed $field = null, mixed $value = null): void { $this->model->orderBy("site ASC,name ASC"); parent::setOrderBy($field, $value); } protected function action_process_fieldhook(string $field, $value, array $formDatas): array { switch ($field) { case 'role': if (is_string($value)) { $value = ($value === '') ? [] : explode(DEFAULTS["DELIMITER_COMMA"], $value); } elseif (!is_array($value)) { $value = []; } $value = array_values(array_filter(array_map( fn($v) => trim((string) ($v ?? ''), " \t\n\r\0\x0B\""), $value ))); $formDatas[$field] = $value; break; default: $formDatas = parent::action_process_fieldhook($field, $value, $formDatas); break; } return $formDatas; } public function history(string|int $uid, string $history): CommonEntity { return $this->dbTransaction(function () use ($uid, $history) { $entity = $this->getEntity($uid); if (!$entity) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다."); } $formDatas['user_uid'] = (int) $this->getAuthContext()->getUID(); $formDatas['history'] = $history; // 검증 통과 후 엔티티 반영 $entity->fill($formDatas); if (!$entity->hasChanged()) { return $entity; } return $this->save_process($entity); }, __FUNCTION__); } }