title = lang("{$this->getService()->getClassName()}.title"); $this->class_path .= $this->getService()->getClassName(); $this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/'; // $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR; } public function getService(): ServiceService { if (!$this->_service) { $this->_service = new ServiceService($this->request); } return $this->_service; } public function getHelper(): ServiceHelper { if (!$this->_helper) { $this->_helper = new ServiceHelper($this->request); } return $this->_helper; } public function getServiceItemService(): ServiceItemService { if (!$this->_serviceItemService) { $this->_serviceItemService = new ServiceItemService($this->request); } return $this->_serviceItemService; } final public function getEquipmentService(string $key): mixed { if (!array_key_exists($key, $this->_equipmentService)) { switch ($key) { case 'SERVER': $this->_equipmentService[$key] = new ServerService(); break; case 'CPU': $this->_equipmentService[$key] = new CpuService(); break; case 'RAM': $this->_equipmentService[$key] = new RamService(); break; case 'STORAGE': $this->_equipmentService[$key] = new StorageService(); break; case 'LINE': $this->_equipmentService[$key] = new LineService(); break; case 'IP': $this->_equipmentService[$key] = new IpService(); break; case 'DEFENCE': $this->_equipmentService[$key] = new DefenceService(); break; case 'SOFTWARE': $this->_equipmentService[$key] = new SoftwareService(); break; case 'DOMAIN': $this->_equipmentService[$key] = new DomainService(); break; default: throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}"); } } return $this->_equipmentService[$key]; } protected function getFormFieldOption(string $field, array $options = []): array { switch ($field) { case 'ownerinfo_uid': foreach ($this->getClientService()->getEntities() as $entity) { $options[$entity->getPK()] = $entity->getTitle(); } break; case 'SERVER': case 'CPU': case 'RAM': case 'STORAGE': case 'LINE': case 'IP': case 'DEFENCE': case 'SOFTWARE': case 'DOMAIN': foreach ($this->getEquipmentService($field)->getEntities() as $entity) { $options[$entity->getPK()] = $entity->getTitle(); } break; default: $options = parent::getFormFieldOption($field, $options); break; } return $options; } //Index,FieldForm관련 protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string { switch ($this->getAction()) { case 'create': case 'modify': $this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), $message); $result = $this->view($this->entity->getPK()); break; case 'index': $this->control = $this->getControlDatas(); $this->getHelper()->setViewDatas($this->getViewDatas()); $result = view($this->view_path . 'service' . DIRECTORY_SEPARATOR . $this->getAction(), ['viewDatas' => $this->getViewDatas()]); break; default: $result = parent::getResultSuccess($message); break; } return $result; } //Index,FieldForm관련 protected function index_process(): array { //추가 Field작업 처리 $this->item_types = lang($this->getServiceItemService()->getClassName() . '.' . strtoupper('ITEM_TYPE')); foreach ($this->item_types as $field => $label) { $this->setFilterFieldOption($field, $this->getFormFieldOption($field)); } $entities = []; foreach (parent::index_process() as $entity) { foreach ($this->item_types as $field => $label) { $entity->setItemEntities( $field, $this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $field]) ); } $entities[] = $entity; } // $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임 return $entities; } }