dbmsv4 init...3
This commit is contained in:
parent
c7549e826d
commit
32c2f61ef7
@ -6,6 +6,7 @@ use App\DTOs\CommonDTO;
|
|||||||
use App\Entities\CommonEntity;
|
use App\Entities\CommonEntity;
|
||||||
use App\Libraries\AuthContext;
|
use App\Libraries\AuthContext;
|
||||||
use App\Models\CommonModel;
|
use App\Models\CommonModel;
|
||||||
|
use App\Services\Equipment\ServerService;
|
||||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
@ -224,6 +225,13 @@ abstract class CommonService
|
|||||||
$fields = array_keys($formDatas);
|
$fields = array_keys($formDatas);
|
||||||
$this->getFormService()->setFormFields($fields);
|
$this->getFormService()->setFormFields($fields);
|
||||||
$this->getFormService()->setFormRules('modify', $fields);
|
$this->getFormService()->setFormRules('modify', $fields);
|
||||||
|
// if (static::class === ServerService::class) {
|
||||||
|
// var_dump($this->getFormService()->getFormRules());
|
||||||
|
// echo "<HR>";
|
||||||
|
// var_dump($entity->toArray());
|
||||||
|
// echo "<HR>";
|
||||||
|
// dd($formDatas);
|
||||||
|
// }
|
||||||
// 데이터 검증
|
// 데이터 검증
|
||||||
if (!$this->getFormService()->validate($formDatas)) {
|
if (!$this->getFormService()->validate($formDatas)) {
|
||||||
throw new ValidationException(
|
throw new ValidationException(
|
||||||
|
|||||||
@ -233,10 +233,8 @@ class ServiceService extends CustomerService
|
|||||||
service('paymentservice')->modifyByService($oldEntity, $entity);
|
service('paymentservice')->modifyByService($oldEntity, $entity);
|
||||||
//서버정보 연결 신규서버로 변경
|
//서버정보 연결 신규서버로 변경
|
||||||
if ($oldEntity->getServerInfoUID() !== $entity->getServerInfoUID()) {
|
if ($oldEntity->getServerInfoUID() !== $entity->getServerInfoUID()) {
|
||||||
//기존서버는 대체서버로 변경
|
// throw new RuntimeException("{$oldEntity->getServerInfoUID()} !== {$entity->getServerInfoUID()}");
|
||||||
service('equipment_serverservice')->modifyByService($oldEntity, $entity);
|
service('equipment_serverservice')->modifyByService($oldEntity, $entity);
|
||||||
//신규서버는 메인서버로 추가
|
|
||||||
service('equipment_serverservice')->attatchToService($entity, $entity->getServerInfoUID());
|
|
||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -275,23 +275,22 @@ class ServerService extends EquipmentService
|
|||||||
$formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED'];
|
$formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED'];
|
||||||
parent::modify_process($entity, $formDatas);
|
parent::modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
public function modifyByService(ServiceENtity $oldServiceEntity, ServiceEntity $serviceEntity, array $formDatas = []): void
|
public function modifyByService(ServiceENtity $oldServiceEntity, ServiceEntity $serviceEntity): void
|
||||||
{
|
{
|
||||||
//기존 메인서버 정보를 대체서버로 변경
|
//기존 메인서버 정보
|
||||||
$oldEntity = $this->getEntity($oldServiceEntity->getServerInfoUID());
|
$oldEntity = $this->getEntity($oldServiceEntity->getServerInfoUID());
|
||||||
if (!$oldEntity instanceof ServerEntity) {
|
if (!$oldEntity instanceof ServerEntity) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$oldServiceEntity->getServerInfoUID()}에 해당하는 서비스의 기존 메인 서버정보을 찾을수 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$oldServiceEntity->getServerInfoUID()}에 해당하는 서비스의 기존 메인 서버정보을 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
//기존서버는 대체서버로 변경
|
//신규 메인서버 정보
|
||||||
parent::modify_process($oldEntity, ['type' => 'alternative']);
|
|
||||||
//신규 메인서버 설정
|
|
||||||
$entity = $this->getEntity($serviceEntity->getServerInfoUID());
|
$entity = $this->getEntity($serviceEntity->getServerInfoUID());
|
||||||
if (!$entity instanceof ServerEntity) {
|
if (!$entity instanceof ServerEntity) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$serviceEntity->getServerInfoUID()}에 해당하는 서비스의 신규 메인 서버정보을 찾을수 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$serviceEntity->getServerInfoUID()}에 해당하는 서비스의 신규 메인 서버정보을 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
//신규 메인서버는 기존 메인서버의 타입으로 설정
|
//신규 메인서버는 기존 메인서버의 타입으로 설정 식뉴규서버는 메인서버로 추가
|
||||||
$formDatas['type'] = $oldEntity->getType();
|
$this->attatchToService($serviceEntity, $entity->getPK(), ['type' => $oldEntity->getType()]);
|
||||||
parent::modify_process($entity, $formDatas);
|
//기존서버는 대체서버로 변경
|
||||||
|
parent::modify_process($oldEntity, ['type' => 'alternative']);
|
||||||
}
|
}
|
||||||
//해지처리
|
//해지처리
|
||||||
public function deatchFromService($uid, array $formDatas = []): void
|
public function deatchFromService($uid, array $formDatas = []): void
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user