dbmsv3 init...1
This commit is contained in:
parent
9793e1e1b9
commit
cad35e3ee3
@ -3,9 +3,10 @@
|
||||
namespace App\Interfaces\Part;
|
||||
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\Part\IPEntity;
|
||||
|
||||
interface IPInterface
|
||||
{
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): void;
|
||||
public function detachFromServer(ServerEntity $serverEntity): void;
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): IPEntity;
|
||||
public function detachFromServer(ServerEntity $serverEntity): IPEntity;
|
||||
}
|
||||
|
||||
@ -3,9 +3,10 @@
|
||||
namespace App\Interfaces\Part;
|
||||
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\Part\SWITCHEntity;
|
||||
|
||||
interface SWITCHInterface
|
||||
{
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): void;
|
||||
public function detachFromServer(ServerEntity $serverEntity): void;
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): SWITCHEntity;
|
||||
public function detachFromServer(ServerEntity $serverEntity): SWITCHEntity;
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ class IPService extends PartService implements IPInterface
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
//서버관련 작업
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): void
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): IPEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUID();
|
||||
@ -121,14 +121,15 @@ class IPService extends PartService implements IPInterface
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity(['ip' => $serverEntity->getIP()]);
|
||||
if ($entity instanceof IPEntity) {
|
||||
if (!$entity instanceof IPEntity) {
|
||||
throw new \Exception("{$serverEntity->getIP()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
if ($entity->getStatus() !== STATUS['AVAILABLE']) {
|
||||
throw new \Exception(__METHOD__ . ":에서 오류발생: {$serverEntity->getTitle()}는 사용중입니다.");
|
||||
}
|
||||
$entity = parent::modify($entity, $formDatas);
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
public function detachFromServer(ServerEntity $serverEntity): void
|
||||
public function detachFromServer(ServerEntity $serverEntity): IPEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
@ -142,7 +143,7 @@ class IPService extends PartService implements IPInterface
|
||||
throw new \Exception("{$serverEntity->getIP()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
//IP정보 수정
|
||||
parent::modify($entity, $formDatas);
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
//서버파트관련 작업
|
||||
public function attachToServerPart(ServerPartEntity $serverPartEntity): IPEntity
|
||||
|
||||
@ -91,7 +91,7 @@ class SWITCHService extends PartService implements SWITCHInterface
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
//서버관련 작업
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): void
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): SWITCHEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUID();
|
||||
@ -102,15 +102,16 @@ class SWITCHService extends PartService implements SWITCHInterface
|
||||
throw new \Exception(__METHOD__ . ":에서 오류발생: Switch상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//Switch정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity(['code' => $serverEntity->getCode()]);
|
||||
if ($entity instanceof SWITCHEntity) {
|
||||
$entity = $this->getEntity(['code' => $serverEntity->getSwitch()]);
|
||||
if (!$entity instanceof SWITCHEntity) {
|
||||
throw new \Exception("{$serverEntity->getSwitch()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
}
|
||||
if ($entity->getStatus() !== STATUS['AVAILABLE']) {
|
||||
throw new \Exception(__METHOD__ . ":에서 오류발생: {$serverEntity->getTitle()}는 사용중입니다.");
|
||||
}
|
||||
$entity = parent::modify($entity, $formDatas);
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
public function detachFromServer(ServerEntity $serverEntity): void
|
||||
public function detachFromServer(ServerEntity $serverEntity): SWITCHEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
@ -122,12 +123,12 @@ class SWITCHService extends PartService implements SWITCHInterface
|
||||
throw new \Exception(__METHOD__ . ":에서 오류발생: Switch상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//Switch정보가져오기
|
||||
$entity = $this->getEntity(['code' => $serverEntity->getCode()]);
|
||||
$entity = $this->getEntity(['code' => $serverEntity->getSwitch()]);
|
||||
if (!$entity instanceof SWITCHEntity) {
|
||||
throw new \Exception("{$serverEntity->getIP()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
throw new \Exception("{$serverEntity->getSwitch()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
}
|
||||
//Switch정보 수정
|
||||
parent::modify($entity, $formDatas);
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
//서버파트관련 작업
|
||||
public function attachToServerPart(ServerPartEntity $serverPartEntity): SWITCHEntity
|
||||
|
||||
Loading…
Reference in New Issue
Block a user