diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index 4643942..d900c68 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -367,7 +367,7 @@ define('SERVICE_NEW_INTERVAL', $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVIC
//서버 PartType
define("SERVER", [
- "PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS']
+ "PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'SOFTWARE'],
]);
//결제관련
diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php
index f6f0feb..86e6017 100644
--- a/app/Controllers/Admin/Equipment/ServerController.php
+++ b/app/Controllers/Admin/Equipment/ServerController.php
@@ -20,9 +20,7 @@ class ServerController extends EquipmentController
$this->class_path .= $this->getService()->getClassName();
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
-
- $this->serverinfopartinfo_cnt_range = array_combine(range(0, 10), range(0, 10));
- $this->serverinfopartinfo_extra_options = array_merge(["" => "RAID 선택"], lang("{$this->getService()->getClassName()}.EXTRAS"));
+ $this->serverinfopartinfo_cnt_options = array_combine(range(1, 10), range(1, 10));
}
public function getService(): ServerService
{
diff --git a/app/Entities/Equipment/ServerPartEntity.php b/app/Entities/Equipment/ServerPartEntity.php
index cc6be10..fe2f42b 100644
--- a/app/Entities/Equipment/ServerPartEntity.php
+++ b/app/Entities/Equipment/ServerPartEntity.php
@@ -14,21 +14,17 @@ class ServerPartEntity extends EquipmentEntity
{
$this->attributes['partEntity'] = $entity;
}
- public function getPartEntity(): PartEntity
+ public function getPartEntity(): PartEntity|null
{
- return $this->attributes['partEntity'];
- }
- public function getType(): string
- {
- return $this->getPartEntity()->getType() ?? "";
+ return $this->attributes['partEntity'] ?? null;
}
public function getTitle(): string
{
- return $this->getPartEntity()->getTitle() ?? "";
+ return $this->getPartEntity() === null ? "" : $this->getPartEntity()->getTitle();
}
public function getPrice(): int
{
- return $this->getPartEntity()->getPrice() ?? 0;
+ return $this->getPartEntity() === null ? 0 : $this->getPartEntity()->getPrice();
}
//기본기능용
public function getPartInfoUID(): int
@@ -43,6 +39,10 @@ class ServerPartEntity extends EquipmentEntity
{
return $this->attributes['serviceinfo_uid'] ?? null;
}
+ public function getType(): string
+ {
+ return $this->attributes['type'];
+ }
public function getBilling(): string
{
return $this->attributes['billing'];
diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php
index 7d12b1d..9a3e6fe 100644
--- a/app/Helpers/Equipment/ServerHelper.php
+++ b/app/Helpers/Equipment/ServerHelper.php
@@ -11,15 +11,17 @@ class ServerHelper extends EquipmentHelper
parent::__construct();
$this->setTitleField(field: ServerModel::TITLE);
}
- private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $type): string
+ private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
{
+ //Type별로 부품연결정보가 있는지 확인
$serverpartEntity = null;
if (array_key_exists('entity', $viewDatas)) {
- $serverpartEntity = $viewDatas['entity']->getServerPartEntity($type);
+ $serverpartEntity = $viewDatas['entity']->getServerPartEntity($partType);
}
$form = "";
- if ($serverpartEntity !== null) { //수정시 사용할 hidden uid
- $form = form_hidden("serverinfopartinfo_uid_{$type}", $serverpartEntity->getPK());
+ //수정시 Type별 사용할 hidden serverinfopartinfo_uid
+ if ($serverpartEntity !== null) {
+ $form .= form_hidden("serverinfopartinfo_uid_{$partType}", $serverpartEntity->getPK());
}
//기존 입력화면에서 return 된것인지?
if ($value === null && $serverpartEntity !== null) {
@@ -31,6 +33,10 @@ class ServerHelper extends EquipmentHelper
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
+ case 'code':
+ // $extras['readonly'] = in_array($viewDatas['control']['action'], ['modify_form']) ? ' readonly' : '';
+ $form = parent::getFieldForm($field, $value, $viewDatas, $extras);
+ break;
case 'manufactur_at':
case 'format_at':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
@@ -39,21 +45,42 @@ class ServerHelper extends EquipmentHelper
case 'partinfo_uid_CPU':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU');
break;
+ case 'serverinfopartinfo_uid_CPU_cnt':
+ $form = form_dropdown($field, $viewDatas['serverinfopartinfo_cnt_options'], $value, $extras) . "개";
+ break;
case 'partinfo_uid_RAM':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',);
break;
+ case 'serverinfopartinfo_uid_RAM_cnt':
+ $form = form_dropdown($field, $viewDatas['serverinfopartinfo_cnt_options'], $value, $extras) . "개";
+ break;
case 'partinfo_uid_DISK':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK');
break;
+ case 'serverinfopartinfo_uid_DISK_cnt':
+ $form = form_dropdown($field, $viewDatas['serverinfopartinfo_cnt_options'], $value, $extras) . "개";
+ break;
+ case 'serverinfopartinfo_uid_DISK_extra':
+ $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
+ break;
case 'partinfo_uid_OS':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS');
break;
+ case 'serverinfopartinfo_uid_OS_cnt':
+ $form = form_dropdown($field, $viewDatas['serverinfopartinfo_cnt_options'], $value, $extras) . "개";
+ break;
case 'partinfo_uid_DB':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB');
break;
+ case 'serverinfopartinfo_uid_DB_cnt':
+ $form = form_dropdown($field, $viewDatas['serverinfopartinfo_cnt_options'], $value, $extras) . "개";
+ break;
case 'partinfo_uid_SOFTWARE':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE');
break;
+ case 'serverinfopartinfo_uid_SOFTWARE_cnt':
+ $form = form_dropdown($field, $viewDatas['serverinfopartinfo_cnt_options'], $value, $extras) . "개";
+ break;
case 'ipinfo_uid':
case 'csinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
@@ -65,6 +92,19 @@ class ServerHelper extends EquipmentHelper
}
return $form;
}
+ private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string
+ {
+ $serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType);
+ if ($serverPartEntity !== null) {
+ $value .= sprintf(
+ "
%s%s %s
",
+ $serverPartEntity->getTitle(),
+ $serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "개" : "",
+ $serverPartEntity->getExtra() ?? ""
+ );
+ }
+ return $value;
+ }
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
@@ -72,18 +112,13 @@ class ServerHelper extends EquipmentHelper
case 'format_at':
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
- case 'serverpartinfo':
- $value = "";
- foreach (SERVER['PARTTYPES'] as $partType) {
- $serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType);
- $value .= sprintf(
- "%s : %s%s %s
",
- $serverPartEntity->getType(),
- $serverPartEntity->getTitle(),
- $serverPartEntity->getCnt() > 1 ? "*" . $serverPartEntity->getCnt() . "개" : "",
- $serverPartEntity->getExtra() ?? ""
- );
- }
+ case 'CPU':
+ case 'RAM':
+ case 'DISK':
+ case 'OS':
+ case 'DB':
+ case 'SOFTWARE':
+ $value = $this->getServerPartView($field, $value, $viewDatas, $extras, $field);
break;
case 'ipinfo_uid':
$value = "";
diff --git a/app/Language/en/Equipment/Server.php b/app/Language/en/Equipment/Server.php
index ee3e0c1..bfa9c4d 100644
--- a/app/Language/en/Equipment/Server.php
+++ b/app/Language/en/Equipment/Server.php
@@ -19,11 +19,18 @@ return [
"ipinfo_uid" => "IP정보",
"csinfo_uid" => "CS정보",
'partinfo_uid_CPU' => "CPU",
+ 'serverinfopartinfo_uid_CPU_cnt' => "CPU갯수",
'partinfo_uid_RAM' => "RAM",
+ 'serverinfopartinfo_uid_RAM_cnt' => "RAM갯수",
'partinfo_uid_DISK' => "DISK",
+ 'serverinfopartinfo_uid_DISK_cnt' => "DISK갯수",
+ 'serverinfopartinfo_uid_DISK_extra' => "RAID설정",
'partinfo_uid_OS' => "OS",
+ 'serverinfopartinfo_uid_OS_cnt' => "OS갯수",
'partinfo_uid_DB' => "DB",
+ 'serverinfopartinfo_uid_DB_cnt' => "DB갯수",
'partinfo_uid_SOFTWARE' => "기타SW",
+ 'serverinfopartinfo_uid_SOFTWARE_cnt' => "SOFTWARE갯수",
],
"TITLE" => [
'HP DL360 Gen6' => "HP DL360 Gen6",
@@ -43,7 +50,7 @@ return [
'occupied' => "서비스중",
'forbidden' => "사용불가",
],
- "EXTRAS" => [
+ "SERVERINFOPARTINFO_UID_DISK_EXTRA" => [
'RAID0' => "RAID0",
'RAID1' => "RAID1",
'RAID5' => "RAID5",
diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php
index 872ed2a..5c4c95b 100644
--- a/app/Models/CommonModel.php
+++ b/app/Models/CommonModel.php
@@ -44,7 +44,6 @@ abstract class CommonModel extends Model
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
- protected $isDebug = false;
protected function __construct()
{
parent::__construct();
@@ -149,7 +148,7 @@ abstract class CommonModel extends Model
}
return $value;
}
- public function create(array $formDatas, bool $isDebug = false): mixed
+ public function create(array $formDatas): mixed
{
// LogCollector::debug("입력내용");
// LogCollector::debug(var_export($formDatas, true));
@@ -164,9 +163,6 @@ abstract class CommonModel extends Model
$convertedFormDatas[$field] = $value;
}
}
- if ($this->isDebug) {
- dd($convertedFormDatas);
- }
// 최종 저장 시 오류 발생하면
if (!$this->save($convertedFormDatas)) {
$message = sprintf(
@@ -188,9 +184,14 @@ abstract class CommonModel extends Model
$pkField = $this->getPKField();
$entity->$pkField = $this->getInsertID();
}
+ $debug = sprintf("debug.%s.%s", str_replace("\\", ".", get_class($this)), __FUNCTION__);
+ if (env($debug, false)) {
+ echo var_dump($formDatas);
+ dd($entity->toArray());
+ }
return $entity;
}
- public function modify(mixed $entity, array $formDatas, bool $isDebug = false): mixed
+ public function modify(mixed $entity, array $formDatas): mixed
{
// 저장하기 전에 데이터 값 변경이 필요한 Field
// LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 전 내용");
@@ -207,9 +208,6 @@ abstract class CommonModel extends Model
$entity->$field = $value;
}
}
- if ($this->isDebug) {
- dd($entity);
- }
//수정일추가
$entity->setUpdatedAt(date("Y-m-d H:i:s"));
// 최종 저장 시 오류 발생하면
@@ -222,6 +220,11 @@ abstract class CommonModel extends Model
LogCollector::debug($message);
throw new \Exception($message);
}
+ $debug = sprintf("debug.%s.%s", str_replace("\\", ".", get_class($this)), __FUNCTION__);
+ if (env($debug, false)) {
+ echo var_dump($formDatas);
+ dd($entity->toArray());
+ }
return $entity;
}
}
diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php
index 11b5840..0461ddc 100644
--- a/app/Services/CommonService.php
+++ b/app/Services/CommonService.php
@@ -11,7 +11,6 @@ abstract class CommonService
private $_model = null;
private $_classNames = [];
private $_serviceDatas = [];
- protected $isDebug = false;
protected function __construct(Model $model)
{
$this->_model = $model;
@@ -50,14 +49,15 @@ abstract class CommonService
try {
$entity = is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where);
if (!$entity) {
- throw new \Exception($message ?? __METHOD__ . "에서 해당 정보가 존재하지 않습니다");
+ return null;
}
return $this->getEntity_process($entity);
} catch (\Exception $e) {
$message = sprintf(
- "\n------%s SQL오류-----\n%s\n------------------------------\n",
+ "\n------%s SQL오류-----
\n%s
\n%s
\n------------------------------\n",
__FUNCTION__,
- $this->getModel()->getLastQuery()
+ $this->getModel()->getLastQuery(),
+ $e->getMessage()
);
throw new \Exception($message);
}
@@ -65,17 +65,13 @@ abstract class CommonService
final public function getEntities(mixed $where = null, array $columns = ['*']): array
{
try {
- $entities = $this->getEntities_process($where, $columns);
- $debug = sprintf("debug.%s.%s", $this->getClassName(), __FUNCTION__);
- if (env($debug, false)) {
- echo $debug . "=>" . $this->getModel()->getLastQuery() . "
";
- }
- return $entities;
+ return $this->getEntities_process($where, $columns);
} catch (\Exception $e) {
$message = sprintf(
- "\n------%s SQL오류-----\n%s\n------------------------------\n",
+ "\n------%s SQL오류-----
\n%s
\n%s
\n------------------------------\n",
__FUNCTION__,
- $this->getModel()->getLastQuery()
+ $this->getModel()->getLastQuery(),
+ $e->getMessage()
);
throw new \Exception($message);
}
@@ -83,18 +79,23 @@ abstract class CommonService
//삭제
final public function delete(mixed $entity): mixed
{
- $result = $this->getModel()->delete($entity->getPK());
- if (!$result) {
+ try {
+ $message = "[{$entity->getTitle()}]" . MESSAGES["DELETED"] . ":";
+ $result = $this->getModel()->delete($entity->getPK());
+ if (!$result) {
+ throw new \Exception($message);
+ }
+ LogCollector::info($message);
+ return $entity;
+ } catch (\Exception $e) {
$message = sprintf(
- "\n------%s SQL오류-----\n%s\n------------------------------\n",
+ "\n------%s SQL오류-----
\n%s
\n%s
\n------------------------------\n",
__FUNCTION__,
- $this->getModel()->getLastQuery()
+ $this->getModel()->getLastQuery(),
+ $e->getMessage()
);
- LogCollector::error($message);
throw new \Exception($message);
}
- LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["DELETED"] . ":");
- return $entity;
}
//Index용
final public function getTotalCount(): int
@@ -148,6 +149,10 @@ abstract class CommonService
foreach ($this->getModel()->select(implode(',', $columns))->findAll() as $entity) {
$entities[$entity->getPK()] = $this->getEntity_process($entity);
}
+ $debug = sprintf("debug.%s.%s", str_replace("\\", ".", get_class($this)), __FUNCTION__);
+ if (env($debug, false)) {
+ echo $debug . "=>" . $this->getModel()->getLastQuery() . "
";
+ }
return $entities;
}
//FieldForm관련용
@@ -197,28 +202,14 @@ abstract class CommonService
//생성
public function create(array $formDatas): mixed
{
- if ($this->isDebug) {
- echo $this->getClassName() . "=>" . __METHOD__;
- echo var_dump($formDatas);
- }
$entity = $this->getModel()->create($formDatas);
- if ($this->isDebug) {
- dd($entity);
- }
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["CREATED"] . ":");
return $entity;
}
//수정
public function modify(mixed $entity, array $formDatas): mixed
{
- if ($this->isDebug) {
- echo $this->getClassName() . "=>" . __METHOD__;
- echo var_dump($formDatas);
- }
$entity = $this->getModel()->modify($entity, $formDatas);
- if ($this->isDebug) {
- dd($entity);
- }
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
return $entity;
}
diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php
index 62447c8..a6b6a85 100644
--- a/app/Services/Equipment/ServerPartService.php
+++ b/app/Services/Equipment/ServerPartService.php
@@ -13,7 +13,7 @@ class ServerPartService extends EquipmentService
public function __construct()
{
parent::__construct(new ServerPartModel());
- $this->addClassName('Server');
+ $this->addClassName('ServerPart');
}
public function getFormFields(): array
{
@@ -54,7 +54,11 @@ class ServerPartService extends EquipmentService
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerPartEntity
{
- $entity->setPartEntity($this->getPartService()->getEntity($entity->getPartInfoUID()));
+ //부품정보 정의
+ $partEntity = $this->getPartService()->getEntity($entity->getPartInfoUID());
+ if ($entity) {
+ $entity->setPartEntity($partEntity);
+ }
return $entity;
}
//기본 기능부분
@@ -90,33 +94,48 @@ class ServerPartService extends EquipmentService
return $options;
}
- private function getFormDatasByServer(ServerEntity $serverEntity, string $partType, array $formDatas): array
+ //서버별 부품연결정보 생성
+ private function createByServer_process(ServerEntity $serverEntity, string $partType, array $formDatas): ServerPartEntity
{
- $temps = [
+ $serverPartFormDatas = [
"partinfo_uid" => $formDatas["partinfo_uid_{$partType}"],
"serverinfo_uid" => $serverEntity->getPK(),
"serviceinfo_uid" => $serverEntity->getServiceInfoUID(),
"type" => $partType,
- "billing" => $formDatas['billing'] ?? ServerPartENtity::DEFAULT_BILLING,
- "amount" => $formDatas["amount"] ?? 0,
- "cnt" => $formDatas["serverinfopartinfo_uid_{$partType}_cnt"] ?? 1,
- "extra" => $formDatas["serverinfopartinfo_uid_{$partType}_extra"] ?? ""
+ "billing" => array_key_exists("serverinfopartinfo_uid_{$partType}_billing", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_billing"] : null,
+ "amount" => array_key_exists("serverinfopartinfo_uid_{$partType}_amount", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_amount"] : 0,
+ "cnt" => array_key_exists("serverinfopartinfo_uid_{$partType}_cnt", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_cnt"] : null,
+ "extra" => array_key_exists("serverinfopartinfo_uid_{$partType}_extra", $formDatas) ? $formDatas["serverinfopartinfo_uid_{$partType}_extra"] : null
];
- return $temps;
+ $entity = parent::create($serverPartFormDatas);
+ //부품정보 정의
+ $partEntity = $this->getPartService()->getEntity($entity->getPartInfoUID());
+ if ($partEntity) {
+ $entity->setPartEntity($partEntity);
+ }
+ return $entity;
}
//생성
public function createByServer(ServerEntity $serverEntity, array $formDatas): array
{
$entities = [];
foreach (SERVER['PARTTYPES'] as $partType) {
- $serverPartFormDatas = $this->getFormDatasByServer(
- $serverEntity,
- $partType,
- $formDatas
- );
- $this->isDebug = true;
- $entities[] = parent::create($serverPartFormDatas);
+ //파트정보 선택했는지 여부에따라 처리
+ if (array_key_exists("partinfo_uid_{$partType}", $formDatas) && $formDatas["partinfo_uid_{$partType}"]) {
+ $entities[] = $this->createByServer_process($serverEntity, $partType, $formDatas);
+ }
}
return $entities;
}
+ //수정
+ public function modifyByServer(ServerEntity $serverEntity, array $formDatas): array
+ {
+ //기존 서벼별 부품연결정보 삭제 후
+ $entities = $this->getEntities(['serverinfo_uid' => $serverEntity->getPK()]);
+ foreach ($entities as $entity) {
+ $this->delete($entity);
+ }
+ //서버별 부품연결정보 생성
+ return $this->createByServer($serverEntity, $formDatas);
+ }
}
diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php
index 4ae481d..f2b12ba 100644
--- a/app/Services/Equipment/ServerService.php
+++ b/app/Services/Equipment/ServerService.php
@@ -28,9 +28,16 @@ class ServerService extends EquipmentService
"format_at",
"status",
"partinfo_uid_CPU",
+ "serverinfopartinfo_uid_CPU_cnt",
"partinfo_uid_RAM",
+ "serverinfopartinfo_uid_RAM_cnt",
"partinfo_uid_DISK",
+ "serverinfopartinfo_uid_DISK_cnt",
+ "serverinfopartinfo_uid_DISK_extra",
"partinfo_uid_OS",
+ "serverinfopartinfo_uid_OS_cnt",
+ "partinfo_uid_SOFTWARE",
+ "serverinfopartinfo_uid_SOFTWARE_cnt",
"ipinfo_uid",
"csinfo_uid",
],
@@ -42,7 +49,9 @@ class ServerService extends EquipmentService
"partinfo_uid_CPU",
"partinfo_uid_RAM",
"partinfo_uid_DISK",
+ "serverinfopartinfo_uid_DISK_extra",
"partinfo_uid_OS",
+ "partinfo_uid_SOFTWARE",
"ipinfo_uid",
"csinfo_uid",
"status"
@@ -59,9 +68,6 @@ class ServerService extends EquipmentService
'title',
'price',
'amount',
- "serverpartinfo",
- "ipinfo_uid",
- "csinfo_uid",
'manufactur_at',
"format_at",
'status'
@@ -72,6 +78,7 @@ class ServerService extends EquipmentService
'type',
"ipinfo_uid",
"csinfo_uid",
+ 'partinfo_uid_SOFTWARE',
'status'
],
];
@@ -104,18 +111,18 @@ class ServerService extends EquipmentService
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerEntity
{
- //서버 부품정보 정의
+ //부품연결정보 정의
foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEnty = $this->getServerPartService()->getEntity(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]);
if ($serverPartEnty) {
$entity->addServerPartEntity($partType, $serverPartEnty);
}
}
- //서버 IP정보 정의
+ //IP정보 정의
foreach ($this->getIPService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $ipEntity) {
$entity->addIPEntity($ipEntity);
}
- //서버 CS정보 정의
+ //CS정보 정의
foreach ($this->getCSService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $csEntity) {
$entity->addCSEntity($csEntity);
}
@@ -183,19 +190,15 @@ class ServerService extends EquipmentService
foreach ($this->getServerPartService()->createByServer($entity, $formDatas) as $serverPartEntity) {
$entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
};
- //IP정보 생성
- $entity->addIPEntity($this->getIPService()->createByServer($entity, $formDatas));
return $entity;
}
public function modify(mixed $entity, array $formDatas): ServerEntity
{
$entity = parent::modify($entity, $formDatas);
- // //ServerPart정보 생성
- // foreach ($this->getServerPartService()->modifyByServer($entity, $formDatas) as $serverPartEntity) {
- // $entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
- // };
- // //IP정보 생성
- // $entity->addIPEntity($this->getIPService()->modifyByServer($entity, $formDatas));
+ // ServerPart정보 수정
+ foreach ($this->getServerPartService()->modifyByServer($entity, $formDatas) as $serverPartEntity) {
+ $entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
+ };
return $entity;
}
diff --git a/app/Views/admin/server/create_form.php b/app/Views/admin/server/create_form.php
index 37ee1a4..56a2d90 100644
--- a/app/Views/admin/server/create_form.php
+++ b/app/Views/admin/server/create_form.php
@@ -6,32 +6,54 @@
= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>