dbmsv4 init...4

This commit is contained in:
최준흠 2026-01-29 17:06:25 +09:00
parent 2e66009a7f
commit cb9384bbbf
29 changed files with 308 additions and 238 deletions

View File

@ -25,29 +25,29 @@ class Database extends Config
* @var array<string, mixed> * @var array<string, mixed>
*/ */
public array $default = [ public array $default = [
'DSN' => '', 'DSN' => '',
'hostname' => 'localhost', 'hostname' => 'localhost',
'username' => '', 'username' => '',
'password' => '', 'password' => '',
'database' => '', 'database' => '',
'DBDriver' => 'MySQLi', 'DBDriver' => 'MySQLi',
'DBPrefix' => '', 'DBPrefix' => '',
'pConnect' => false, 'pConnect' => false,
'DBDebug' => true, 'DBDebug' => true,
'charset' => 'utf8mb4', 'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci', 'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '', 'swapPre' => '',
'encrypt' => false, 'encrypt' => false,
'compress' => false, 'compress' => false,
'strictOn' => false, 'strictOn' => false,
'failover' => [], 'failover' => [],
'port' => 3306, 'port' => 3306,
'numberNative' => false, 'numberNative' => true,
'foundRows' => false, 'foundRows' => false,
'dateFormat' => [ 'dateFormat' => [
'date' => 'Y-m-d', 'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s', 'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s', 'time' => 'H:i:s',
], ],
]; ];
@ -163,29 +163,29 @@ class Database extends Config
* @var array<string, mixed> * @var array<string, mixed>
*/ */
public array $tests = [ public array $tests = [
'DSN' => '', 'DSN' => '',
'hostname' => '127.0.0.1', 'hostname' => '127.0.0.1',
'username' => '', 'username' => '',
'password' => '', 'password' => '',
'database' => ':memory:', 'database' => ':memory:',
'DBDriver' => 'SQLite3', 'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false, 'pConnect' => false,
'DBDebug' => true, 'DBDebug' => true,
'charset' => 'utf8', 'charset' => 'utf8',
'DBCollat' => '', 'DBCollat' => '',
'swapPre' => '', 'swapPre' => '',
'encrypt' => false, 'encrypt' => false,
'compress' => false, 'compress' => false,
'strictOn' => false, 'strictOn' => false,
'failover' => [], 'failover' => [],
'port' => 3306, 'port' => 3306,
'foreignKeys' => true, 'foreignKeys' => true,
'busyTimeout' => 1000, 'busyTimeout' => 1000,
'dateFormat' => [ 'dateFormat' => [
'date' => 'Y-m-d', 'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s', 'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s', 'time' => 'H:i:s',
], ],
]; ];

View File

@ -21,14 +21,14 @@ class BoardEntity extends CommonEntity
} }
final public function getUserUid(): int|null final public function getUserUid(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->user_uid ?? null;
} }
final public function getWorkerUid(): int|null final public function getWorkerUid(): int|null
{ {
return $this->attributes['worker_uid'] ?? null; return $this->worker_uid ?? null;
} }
final public function getCaregory(): string final public function getCaregory(): string
{ {
return $this->attributes['category'] ?? ""; return $this->category ?? "";
} }
} }

View File

@ -7,13 +7,20 @@ use CodeIgniter\Entity\Entity;
abstract class CommonEntity extends Entity abstract class CommonEntity extends Entity
{ {
protected $datamap = []; protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $dates = ['created_at', 'updated_at', 'deleted_at'];
//사용법 : $client->created_at->format('Y-m-d') //사용법 : $client->created_at->format('Y-m-d')
//비교방법 : if ($client->created_at < new \DateTime('2024-01-01')) { //비교방법 : if ($client->created_at < new \DateTime('2024-01-01')) {
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
parent::__construct($data); parent::__construct($data);
} }
public function __get(string $key)
{
if (array_key_exists($key, $this->attributes)) {
return $this->attributes[$key];
}
return parent::__get($key);
}
final public function getPK(): int|string final public function getPK(): int|string
{ {
$field = constant("static::PK"); $field = constant("static::PK");
@ -30,18 +37,18 @@ abstract class CommonEntity extends Entity
} }
final public function getStatus(): string final public function getStatus(): string
{ {
return $this->attributes['status'] ?? ""; return $this->status ?? "";
} }
final public function getUpdatedAt(): string final public function getUpdatedAt(): string
{ {
return $this->attributes['updated_at'] ?? ""; return $this->updated_at ?? "";
} }
final public function getCreatedAt(): string final public function getCreatedAt(): string
{ {
return $this->attributes['created_at'] ?? ""; return $this->created_at ?? "";
} }
final public function getDeletedAt(): string final public function getDeletedAt(): string
{ {
return $this->attributes['deleted_at'] ?? ""; return $this->deleted_at ?? "";
} }
} }

View File

@ -27,7 +27,7 @@ class ClientEntity extends CustomerEntity
public function getUserUid(): int|null public function getUserUid(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->user_uid ?? null;
} }
//기본기능 //기본기능
public function getCustomTitle(mixed $title = null): string public function getCustomTitle(mixed $title = null): string
@ -36,27 +36,27 @@ class ClientEntity extends CustomerEntity
} }
public function getName(): string public function getName(): string
{ {
return $this->attributes['name']; return $this->name;
} }
public function getSite(): string public function getSite(): string
{ {
return $this->attributes['site']; return $this->site;
} }
public function getAccountBalance(): int public function getAccountBalance(): int
{ {
return $this->attributes['account_balance'] ?? 0; return $this->account_balance ?? 0;
} }
public function getCouponBalance(): int public function getCouponBalance(): int
{ {
return $this->attributes['coupon_balance'] ?? 0; return $this->coupon_balance ?? 0;
} }
public function getPointBalance(): int public function getPointBalance(): int
{ {
return $this->attributes['point_balance'] ?? 0; return $this->point_balance ?? 0;
} }
public function getHistory(): string|null public function getHistory(): string|null
{ {
return $this->attributes['history']; return $this->history;
} }
/* /*
* 사용자의 역할을 배열 형태로 반환합니다. * 사용자의 역할을 배열 형태로 반환합니다.
@ -65,7 +65,7 @@ class ClientEntity extends CustomerEntity
*/ */
public function getRole(): array public function getRole(): array
{ {
$role = $this->attributes['role'] ?? null; $role = $this->role ?? null;
// 1. 이미 배열인 경우 (방어적 코딩) // 1. 이미 배열인 경우 (방어적 코딩)
if (is_array($role)) { if (is_array($role)) {
return array_filter($role); return array_filter($role);
@ -113,6 +113,6 @@ class ClientEntity extends CustomerEntity
$cleanedRoles = array_map(fn($item) => trim((string) ($item ?? ''), " \t\n\r\0\x0B\""), $roleArray); $cleanedRoles = array_map(fn($item) => trim((string) ($item ?? ''), " \t\n\r\0\x0B\""), $roleArray);
$roleArray = array_filter($cleanedRoles); $roleArray = array_filter($cleanedRoles);
// 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다. // 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다.
$this->attributes['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $roleArray); $this->role = implode(DEFAULTS["DELIMITER_ROLE"], $roleArray);
} }
} }

View File

@ -14,8 +14,8 @@ class ServiceEntity extends CustomerEntity
'site' => '', 'site' => '',
'location' => '', 'location' => '',
'rack' => 0, 'rack' => 0,
'coupon_balance' => 0, 'coupon_balance' => 0,
'line' => 0, 'line' => 0,
'billing_at' => '', 'billing_at' => '',
'sale' => 0, 'sale' => 0,
'amount' => 0, 'amount' => 0,
@ -30,58 +30,58 @@ class ServiceEntity extends CustomerEntity
} }
final public function getUserUid(): int|null final public function getUserUid(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->user_uid ?? null;
} }
final public function getClientInfoUid(): int|null final public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->clientinfo_uid ?? null;
} }
final public function getServerInfoUid(): int|null final public function getServerInfoUid(): int|null
{ {
return $this->attributes['serverinfo_uid'] ?? null; return $this->serverinfo_uid ?? null;
} }
//기본기능용 //기본기능용
final public function getCode(): string final public function getCode(): string
{ {
return $this->attributes['code'] ?? ''; return $this->code ?? '';
} }
final public function getSite(): string final public function getSite(): string
{ {
return $this->attributes['site'] ?? ''; return $this->site ?? '';
} }
final public function getLocation(): string final public function getLocation(): string
{ {
return $this->attributes['location'] ?? ''; return $this->location ?? '';
} }
final public function getBillingAt(): string final public function getBillingAt(): string
{ {
return $this->attributes['billing_at'] ?? ''; return $this->billing_at ?? '';
} }
//청구금액->기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액 //청구금액->기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액
//상면비 //상면비
final public function getRack(): int final public function getRack(): int
{ {
return $this->attributes['rack'] ?? 0; return $this->rack ?? 0;
} }
//회선비 //회선비
final public function getLine(): int final public function getLine(): int
{ {
return $this->attributes['line'] ?? 0; return $this->line ?? 0;
} }
final public function getSale(): int final public function getSale(): int
{ {
return $this->attributes['sale'] ?? 0; return $this->sale ?? 0;
} }
final public function getAmount(): int final public function getAmount(): int
{ {
return $this->attributes['amount'] ?? 0; return $this->amount ?? 0;
} }
final public function getStartAt(): string final public function getStartAt(): string
{ {
return $this->attributes['start_at'] ?? ''; return $this->start_at ?? '';
} }
public function getHistory(): string public function getHistory(): string
{ {
return $this->attributes['history'] ?? ''; return $this->history ?? '';
} }
} }

View File

@ -6,16 +6,22 @@ use App\Models\Customer\Wallet\AccountModel;
class AccountEntity extends WalletEntity class AccountEntity extends WalletEntity
{ {
const PK = AccountModel::PK; const PK = AccountModel::PK;
const TITLE = AccountModel::TITLE; const TITLE = AccountModel::TITLE;
protected $casts = [
'clientinfo_uid' => 'integer',
'user_uid' => '?integer',
];
protected $attributes = [ protected $attributes = [
'clientinfo_uid' => null,
'user_uid' => null,
'title' => '', 'title' => '',
'bank' => '', 'bank' => '',
'alias' => '', 'alias' => '',
'issue_at' => '', 'issue_at' => '',
'amount' => 0, 'amount' => 0,
'balance' => 0, 'balance' => 0,
'status' => '', 'status' => '',
'content' => '' 'content' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
@ -25,14 +31,14 @@ class AccountEntity extends WalletEntity
//기본기능 //기본기능
public function getBank(): string public function getBank(): string
{ {
return $this->attributes['bank'] ?? ''; return $this->bank ?? '';
} }
public function getAlias(): string public function getAlias(): string
{ {
return $this->attributes['alias'] ?? ''; return $this->alias ?? '';
} }
public function getIssueAt(): string public function getIssueAt(): string
{ {
return $this->attributes['issue_at'] ?? ''; return $this->issue_at ?? '';
} }
} }

View File

@ -7,13 +7,13 @@ use App\Models\Customer\Wallet\CouponModel;
class CouponEntity extends WalletEntity class CouponEntity extends WalletEntity
{ {
const PK = CouponModel::PK; const PK = CouponModel::PK;
const TITLE = CouponModel::TITLE; const TITLE = CouponModel::TITLE;
protected $attributes = [ protected $attributes = [
'title' => '', 'title' => '',
'amount' => 0, 'amount' => 0,
'balance' => 0, 'balance' => 0,
'status' => '', 'status' => '',
'content' => '' 'content' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)

View File

@ -12,7 +12,7 @@ class PointEntity extends WalletEntity
'title' => '', 'title' => '',
'amount' => 0, 'amount' => 0,
'balance' => 0, 'balance' => 0,
'status' => '', 'status' => '',
'content' => '' 'content' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)

View File

@ -13,23 +13,23 @@ abstract class WalletEntity extends CustomerEntity
} }
final public function getUserUid(): int|null final public function getUserUid(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->user_uid ?? null;
} }
final public function getClientInfoUid(): int|null final public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->clientinfo_uid ?? null;
} }
//기본기능 //기본기능
final public function getAmount(): int final public function getAmount(): int
{ {
return $this->attributes['amount'] ?? 0; return $this->amount ?? 0;
} }
final public function getBalance(): int final public function getBalance(): int
{ {
return $this->attributes['balance'] ?? 0; return $this->balance ?? 0;
} }
final public function getContent(): string final public function getContent(): string
{ {
return $this->attributes['content'] ?? ''; return $this->content ?? '';
} }
} }

View File

@ -6,7 +6,7 @@ use App\Models\Equipment\CHASSISModel;
class CHASSISEntity extends EquipmentEntity class CHASSISEntity extends EquipmentEntity
{ {
const PK = CHASSISModel::PK; const PK = CHASSISModel::PK;
const TITLE = CHASSISModel::TITLE; const TITLE = CHASSISModel::TITLE;
protected $attributes = [ protected $attributes = [
'title' => '', 'title' => '',
@ -22,45 +22,45 @@ class CHASSISEntity extends EquipmentEntity
{ {
parent::__construct($data); parent::__construct($data);
} }
public function getCPUInfoUid(): int|null public function getCPUInfoUid(): int|null
{ {
return $this->attributes['cpuinfo_uid'] ?? null; return $this->cpuinfo_uid ?? null;
} }
public function getRAMInfoUid(): int|null public function getRAMInfoUid(): int|null
{ {
return $this->attributes['raminfo_uid'] ?? null; return $this->raminfo_uid ?? null;
} }
public function getDISKInfoUid(): int|null public function getDISKInfoUid(): int|null
{ {
return $this->attributes['diskinfo_uid'] ?? null; return $this->diskinfo_uid ?? null;
} }
//기본기능 //기본기능
public function getPrice(): int public function getPrice(): int
{ {
return $this->attributes['price'] ?? 0; return $this->price ?? 0;
} }
public function getStock(): int public function getStock(): int
{ {
return $this->attributes['stock'] ?? 0; return $this->stock ?? 0;
} }
public function getUsed(): int public function getUsed(): int
{ {
return $this->attributes['used'] ?? 0; return $this->used ?? 0;
} }
public function getAvailable(): int public function getAvailable(): int
{ {
return $this->getStock() - $this->getUsed(); return $this->getStock() - $this->getUsed();
} }
public function getCPUCnt(): int public function getCPUCnt(): int
{ {
return $this->attributes['cpu_cnt'] ?? 0; return $this->cpu_cnt ?? 0;
} }
public function getRAMCnt(): int public function getRAMCnt(): int
{ {
return $this->attributes['ram_cnt'] ?? 0; return $this->ram_cnt ?? 0;
} }
public function getDISKCnt(): int public function getDISKCnt(): int
{ {
return $this->attributes['disk_cnt'] ?? 0; return $this->disk_cnt ?? 0;
} }
} }

View File

@ -24,26 +24,26 @@ class LineEntity extends EquipmentEntity
const TITLE = LineModel::TITLE; const TITLE = LineModel::TITLE;
public function getType(): string public function getType(): string
{ {
return $this->attributes['type'] ?? ''; return $this->type ?? '';
} }
public function getProtocol(): string public function getProtocol(): string
{ {
return $this->attributes['protocol'] ?? ''; return $this->protocol ?? '';
} }
public function getBandwith(): string public function getBandwith(): string
{ {
return $this->attributes['bandwith'] ?? ''; return $this->bandwith ?? '';
} }
public function getStartAt(): string public function getStartAt(): string
{ {
return $this->attributes['start_at'] ?? ''; return $this->start_at ?? '';
} }
public function getEndAt(): string public function getEndAt(): string
{ {
return $this->attributes['end_at'] ?? ''; return $this->end_at ?? '';
} }
public function getContent(): string public function getContent(): string
{ {
return $this->attributes['content'] ?? ''; return $this->content ?? '';
} }
} }

View File

@ -8,7 +8,13 @@ class ServerEntity extends EquipmentEntity
{ {
const PK = ServerModel::PK; const PK = ServerModel::PK;
const TITLE = ServerModel::TITLE; const TITLE = ServerModel::TITLE;
protected $attributes = [ protected $attributes = [
'user_uid' => null,
'clientinfo_uid' => null,
'serviceinfo_uid' => null,
'chassisinfo_uid' => null,
'switchinfo_uid' => null,
'code' => '', 'code' => '',
'title' => '', 'title' => '',
'type' => '', 'type' => '',
@ -26,19 +32,23 @@ class ServerEntity extends EquipmentEntity
} }
final public function getClientInfoUid(): int|null final public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; $val = $this->clientinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
} }
final public function getServiceInfoUid(): int|null final public function getServiceInfoUid(): int|null
{ {
return $this->attributes['serviceinfo_uid'] ?? null; $val = $this->serviceinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
} }
final public function getChassisInfoUid(): int|null final public function getChassisInfoUid(): int|null
{ {
return $this->attributes['chassisinfo_uid'] ?? null; $val = $this->chassisinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
} }
final public function getSwitchInfoUid(): int|null final public function getSwitchInfoUid(): int|null
{ {
return $this->attributes['switchinfo_uid'] ?? null; $val = $this->switchinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
} }
//기본기능용 //기본기능용
public function getCustomTitle(mixed $title = null): string public function getCustomTitle(mixed $title = null): string
@ -47,34 +57,34 @@ class ServerEntity extends EquipmentEntity
} }
final public function getCode(): string final public function getCode(): string
{ {
return $this->attributes['code'] ?? ''; return $this->code ?? null;
} }
public function getType(): string public function getType(): string
{ {
return $this->attributes['type'] ?? ''; return $this->type ?? null;
} }
public function getIP(): string public function getIP(): string
{ {
return $this->attributes['ip'] ?? ''; return $this->ip ?? '';
} }
public function getViewer(): string public function getViewer(): string
{ {
return $this->attributes['viewer'] ?? ''; return $this->viewer ?? '';
} }
public function getOS(): string public function getOS(): string
{ {
return $this->attributes['os'] ?? ''; return $this->os ?? '';
} }
public function getPrice(): int public function getPrice(): int
{ {
return $this->attributes['price'] ?? 0; return $this->price ?? 0;
} }
public function getManufacturAt(): string public function getManufacturAt(): string
{ {
return $this->attributes['manufactur_at'] ?? ''; return $this->manufactur_at ?? '';
} }
public function getFormatAt(): string public function getFormatAt(): string
{ {
return $this->attributes['format_at'] ?? ''; return $this->format_at ?? '';
} }
} }

View File

@ -6,9 +6,21 @@ use App\Models\Equipment\ServerPartModel;
class ServerPartEntity extends EquipmentEntity class ServerPartEntity extends EquipmentEntity
{ {
const PK = ServerPartModel::PK; const PK = ServerPartModel::PK;
const TITLE = ServerPartModel::TITLE; const TITLE = ServerPartModel::TITLE;
protected $casts = [
'clientinfo_uid' => '?integer',
'part_uid' => '?integer',
'serverinfo_uid' => 'integer',
'serviceinfo_uid' => '?integer',
];
protected $attributes = [ protected $attributes = [
'clientinfo_uid' => null,
'part_uid' => null,
'serverinfo_uid' => null,
'serviceinfo_uid' => null,
'title' => '', 'title' => '',
'type' => '', 'type' => '',
'billing' => '', 'billing' => '',
@ -21,21 +33,21 @@ class ServerPartEntity extends EquipmentEntity
{ {
parent::__construct($data); parent::__construct($data);
} }
public function getClientInfoUid(): int|null public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->clientinfo_uid ?? null;
} }
public function getServiceInfoUid(): int|null public function getServiceInfoUid(): int|null
{ {
return $this->attributes['serviceinfo_uid'] ?? null; return $this->serviceinfo_uid ?? null;
} }
public function getServerInfoUid(): int|null public function getServerInfoUid(): int|null
{ {
return $this->attributes['serverinfo_uid'] ?? null; return $this->serverinfo_uid ?? null;
} }
public function getPartUid(): int|null public function getPartUid(): int|null
{ {
return $this->attributes['part_uid'] ?? null; return $this->part_uid ?? null;
} }
//기본기능용 //기본기능용
public function getCustomTitle(): string public function getCustomTitle(): string
@ -48,26 +60,26 @@ class ServerPartEntity extends EquipmentEntity
} }
public function getType(): string public function getType(): string
{ {
return $this->attributes['type'] ?? ""; return $this->type ?? "";
} }
public function getBilling(): string public function getBilling(): string
{ {
return $this->attributes['billing'] ?? ""; return $this->billing ?? "";
} }
public function getBillingAt(): string public function getBillingAt(): string
{ {
return $this->attributes['billing_at'] ?? ""; return $this->billing_at ?? "";
} }
public function getCnt(): int public function getCnt(): int
{ {
return $this->attributes['cnt'] ?? 0; return $this->cnt ?? 0;
} }
public function getAmount(): int public function getAmount(): int
{ {
return $this->attributes['amount'] ?? 0; return $this->amount ?? 0;
} }
public function getExtra(): string public function getExtra(): string
{ {
return $this->attributes['extra'] ?? ''; return $this->extra ?? '';
} }
} }

View File

@ -6,7 +6,7 @@ use App\Models\Part\CPUModel;
class CPUEntity extends PartType1Entity class CPUEntity extends PartType1Entity
{ {
const PK = CPUModel::PK; const PK = CPUModel::PK;
const TITLE = CPUModel::TITLE; const TITLE = CPUModel::TITLE;
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {

View File

@ -21,30 +21,30 @@ class CSEntity extends PartType2Entity
parent::__construct($data); parent::__construct($data);
} }
//기본기능 //기본기능
final public function getClientInfoUid(): int|null final public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid']; return $this->clientinfo_uid;
} }
final public function getServiceInfoUid(): int|null final public function getServiceInfoUid(): int|null
{ {
return $this->attributes['serviceinfo_uid']; return $this->serviceinfo_uid;
} }
final public function getServerInfoUid(): int|null final public function getServerInfoUid(): int|null
{ {
return $this->attributes['serverinfo_uid']; return $this->serverinfo_uid;
} }
public function getIP(): string public function getIP(): string
{ {
return $this->attributes['ip'] ?? ''; return $this->ip ?? '';
} }
//기본기능 //기본기능
public function getAccountID(): string public function getAccountID(): string
{ {
return $this->attributes['accountid'] ?? ""; return $this->accountid ?? "";
} }
public function getDomain(): string public function getDomain(): string
{ {
return $this->attributes['domain'] ?? ""; return $this->domain ?? "";
} }
//abstract 선언처리용 //abstract 선언처리용
} }

View File

@ -6,7 +6,7 @@ use App\Models\Part\DISKModel;
class DISKEntity extends PartType1Entity class DISKEntity extends PartType1Entity
{ {
const PK = DISKModel::PK; const PK = DISKModel::PK;
const TITLE = DISKModel::TITLE; const TITLE = DISKModel::TITLE;
protected $attributes = [ protected $attributes = [
'title' => '', 'title' => '',
@ -24,6 +24,6 @@ class DISKEntity extends PartType1Entity
public function getFormat(): int public function getFormat(): int
{ {
return $this->attributes['format'] ?? 0; return $this->format ?? 0;
} }
} }

View File

@ -21,33 +21,33 @@ class IPEntity extends PartType3Entity
{ {
parent::__construct($data); parent::__construct($data);
} }
public function getLineInfoUID(): int|null public function getLineInfoUID(): int|null
{ {
return $this->attributes['lineinfo_uid'] ?? null; return $this->lineinfo_uid ?? null;
} }
public function getOldClientInfoUID(): int|null public function getOldClientInfoUID(): int|null
{ {
return $this->attributes['old_clientinfo_uid'] ?? null; return $this->old_clientinfo_uid ?? null;
} }
final public function getClientInfoUid(): int|null final public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid']; return $this->clientinfo_uid;
} }
final public function getServiceInfoUid(): int|null final public function getServiceInfoUid(): int|null
{ {
return $this->attributes['serviceinfo_uid']; return $this->serviceinfo_uid;
} }
final public function getServerInfoUid(): int|null final public function getServerInfoUid(): int|null
{ {
return $this->attributes['serverinfo_uid']; return $this->serverinfo_uid;
} }
//기본기능 //기본기능
public function getIP(): string public function getIP(): string
{ {
return $this->attributes['ip'] ?? ""; return $this->ip ?? "";
} }
public function getContent(): string public function getContent(): string
{ {
return $this->attributes['content'] ?? ""; return $this->content ?? "";
} }
} }

View File

@ -15,10 +15,10 @@ abstract class PartEntity extends CommonEntity
//기본기능용 //기본기능용
public function getCustomTitle(mixed $title = null): string public function getCustomTitle(mixed $title = null): string
{ {
return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice())); return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice()));
} }
final public function getPrice(): int final public function getPrice(): int
{ {
return $this->attributes['price'] ?? 0; return $this->price ?? 0;
} }
} }

View File

@ -20,11 +20,11 @@ class PartType1Entity extends PartEntity
//기본기능 //기본기능
final public function getStock(): int final public function getStock(): int
{ {
return $this->attributes['stock'] ?? 0; return $this->stock ?? 0;
} }
final public function getUsed(): int final public function getUsed(): int
{ {
return $this->attributes['used'] ?? 0; return $this->used ?? 0;
} }
final public function getAvailable(): int final public function getAvailable(): int
{ {

View File

@ -6,7 +6,7 @@ use App\Models\Part\RAMModel;
class RAMEntity extends PartType1Entity class RAMEntity extends PartType1Entity
{ {
const PK = RAMModel::PK; const PK = RAMModel::PK;
const TITLE = RAMModel::TITLE; const TITLE = RAMModel::TITLE;
protected $attributes = [ protected $attributes = [
'title' => '', 'title' => '',

View File

@ -6,6 +6,6 @@ use App\Models\Part\SOFTWAREModel;
class SOFTWAREEntity extends PartType1Entity class SOFTWAREEntity extends PartType1Entity
{ {
const PK = SOFTWAREModel::PK; const PK = SOFTWAREModel::PK;
const TITLE = SOFTWAREModel::TITLE; const TITLE = SOFTWAREModel::TITLE;
} }

View File

@ -6,7 +6,7 @@ use App\Models\Part\SWITCHModel;
class SWITCHEntity extends PartType3Entity class SWITCHEntity extends PartType3Entity
{ {
const PK = SWITCHModel::PK; const PK = SWITCHModel::PK;
const TITLE = SWITCHModel::TITLE; const TITLE = SWITCHModel::TITLE;
protected $attributes = [ protected $attributes = [
'code' => 0, 'code' => 0,
@ -15,23 +15,22 @@ class SWITCHEntity extends PartType3Entity
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['code'] = '';
parent::__construct($data); parent::__construct($data);
} }
final public function getClientInfoUid(): int|null final public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid']; return $this->clientinfo_uid ?? null;
} }
final public function getServiceInfoUid(): int|null final public function getServiceInfoUid(): int|null
{ {
return $this->attributes['serviceinfo_uid']; return $this->serviceinfo_uid ?? null;
} }
final public function getServerInfoUid(): int|null final public function getServerInfoUid(): int|null
{ {
return $this->attributes['serverinfo_uid']; return $this->serverinfo_uid ?? null;
} }
public function getCode(): string public function getCode(): string
{ {
return $this->attributes['code'] ?? ""; return $this->code ?? "";
} }
} }

View File

@ -25,15 +25,15 @@ class PaymentEntity extends CommonEntity
} }
final public function getUserUid(): int|null final public function getUserUid(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->user_uid ?? null;
} }
final public function getClientInfoUid(): int|null final public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->clientinfo_uid ?? null;
} }
final public function getServiceInfoUid(): int|null final public function getServiceInfoUid(): int|null
{ {
return $this->attributes['serviceinfo_uid'] ?? null; return $this->serviceinfo_uid ?? null;
} }
//기본기능 //기본기능
public function getCustomTitle(): string public function getCustomTitle(): string
@ -42,27 +42,27 @@ class PaymentEntity extends CommonEntity
} }
public function getBilling(): string public function getBilling(): string
{ {
return $this->attributes['billing'] ?? ""; return $this->billing ?? "";
} }
public function getAmount(): int public function getAmount(): int
{ {
return $this->attributes['amount'] ?? 0; return $this->amount ?? 0;
} }
public function getBillingAt(): string public function getBillingAt(): string
{ {
return $this->attributes['billing_at'] ?? ""; return $this->billing_at ?? "";
} }
public function getBillingMonth(): int public function getBillingMonth(): int
{ {
return $this->attributes['billing_month'] ?? 0; return $this->billing_month ?? 0;
} }
public function getPay(): string public function getPay(): string
{ {
return $this->attributes['pay'] ?? ""; return $this->pay ?? "";
} }
public function getContent(): string public function getContent(): string
{ {
return $this->attributes['content'] ?? ""; return $this->content ?? "";
} }
public function getCountDueAt(): string public function getCountDueAt(): string
{ {
@ -72,10 +72,10 @@ class PaymentEntity extends CommonEntity
$due = new DateTime($this->getBillingAt()); $due = new DateTime($this->getBillingAt());
if ($due < $now) { if ($due < $now) {
$interval = $due->diff($now); $interval = $due->diff($now);
$result = "{$interval->days}일지남"; $result = "{$interval->days}일지남";
} else if ($due > $now) { } else if ($due > $now) {
$interval = $now->diff($due); $interval = $now->diff($due);
$day = $interval->days + 1; $day = $interval->days + 1;
$result = "{$day}일전"; $result = "{$day}일전";
} else { } else {
$result = "당일"; $result = "당일";

View File

@ -30,11 +30,11 @@ class UserEntity extends CommonEntity
} }
public function getID(): string public function getID(): string
{ {
return (string) $this->attributes['id']; return (string) $this->id;
} }
public function getPassword(): string public function getPassword(): string
{ {
return $this->attributes['passwd']; return $this->passwd;
} }
/** /**
* 사용자의 역할을 배열 형태로 반환합니다. * 사용자의 역할을 배열 형태로 반환합니다.
@ -43,7 +43,7 @@ class UserEntity extends CommonEntity
*/ */
public function getRole(): array public function getRole(): array
{ {
$role = $this->attributes['role'] ?? null; $role = $this->role ?? null;
// 1. 이미 배열인 경우 (방어적 코딩) // 1. 이미 배열인 경우 (방어적 코딩)
if (is_array($role)) { if (is_array($role)) {
return array_filter($role); return array_filter($role);
@ -70,7 +70,7 @@ class UserEntity extends CommonEntity
{ {
// 입력된 비밀번호가 null이 아니고 비어있지 않을 때만 해시 처리 // 입력된 비밀번호가 null이 아니고 비어있지 않을 때만 해시 처리
if (!empty($password)) { if (!empty($password)) {
$this->attributes['passwd'] = password_hash($password, PASSWORD_BCRYPT); $this->passwd = password_hash($password, PASSWORD_BCRYPT);
} }
} }
@ -99,6 +99,6 @@ class UserEntity extends CommonEntity
$cleanedRoles = array_map(fn($item) => trim((string) ($item ?? ''), " \t\n\r\0\x0B\""), $roleArray); $cleanedRoles = array_map(fn($item) => trim((string) ($item ?? ''), " \t\n\r\0\x0B\""), $roleArray);
$roleArray = array_filter($cleanedRoles); $roleArray = array_filter($cleanedRoles);
// 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다. // 최종적으로 DB에 삽입될 단일 CSV 문자열로 변환하여 저장합니다.
$this->attributes['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $roleArray); $this->role = implode(DEFAULTS["DELIMITER_ROLE"], $roleArray);
} }
} }

View File

@ -21,18 +21,18 @@ class UserSNSEntity extends CommonEntity
//Common Function //Common Function
public function getID(): string public function getID(): string
{ {
return $this->attributes['id']; return $this->id;
} }
public function getSite(): string public function getSite(): string
{ {
return $this->attributes['site']; return $this->site;
} }
public function getEmail(): string public function getEmail(): string
{ {
return $this->attributes['email']; return $this->email;
} }
public function getParent(): int|string public function getParent(): int|string
{ {
return $this->attributes['user_uid']; return $this->user_uid;
} }
} }

View File

@ -126,11 +126,14 @@ abstract class CommonService
* 단일 엔티티를 조회합니다. * 단일 엔티티를 조회합니다.
*/ */
abstract protected function getEntity_process(CommonEntity $entity): CommonEntity; abstract protected function getEntity_process(CommonEntity $entity): CommonEntity;
final public function getEntity(string|int|array $where, ?string $message = null): ?CommonEntity final public function getEntity($where = null, ?string $message = null): ?CommonEntity
{ {
try { try {
$entity = is_array($where) ? $this->model->where($where)->first() : $this->model->find($where); $entity = null;
if (!$entity) { if ($where !== null) {
$entity = is_array($where) ? $this->model->where($where)->first() : $this->model->find($where);
}
if ($entity === null) {
return null; return null;
} }
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사 // 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
@ -234,8 +237,8 @@ abstract class CommonService
{ {
// INSERT 시 Entity의 PK는 0 또는 NULL이어야 함 (DB가 ID를 생성하도록) // INSERT 시 Entity의 PK는 0 또는 NULL이어야 함 (DB가 ID를 생성하도록)
$initialPK = $entity->getPK(); $initialPK = $entity->getPK();
$result = $this->model->save($entity);
log_message('debug', __FUNCTION__ . ":" . var_export($entity, true)); log_message('debug', __FUNCTION__ . ":" . var_export($entity, true));
$result = $this->model->save($entity);
log_message('debug', __FUNCTION__ . ":" . $this->model->getLastQuery()); log_message('debug', __FUNCTION__ . ":" . $this->model->getLastQuery());
// 최종적으로 DB에 반영된 PK를 반환받습니다. (UPDATE이면 기존 PK, INSERT이면 새 PK) // 최종적으로 DB에 반영된 PK를 반환받습니다. (UPDATE이면 기존 PK, INSERT이면 새 PK)
$entity->{$this->getPKField()} = $this->handle_save_result($result, $initialPK); $entity->{$this->getPKField()} = $this->handle_save_result($result, $initialPK);

View File

@ -46,7 +46,28 @@ class ServerPartService extends EquipmentService
{ {
return $entity; return $entity;
} }
private function getFormDatasForServerPart(array $formDatas): array private function getBillingAtByServiceEntity(ServiceEntity $serviceEntity, string $billing): string
{
//청구방식에 따른 결제일 설정
$billing_at = null;
if ($billing === PAYMENT['BILLING']['MONTH']) {
$billing_at = $serviceEntity->getBillingAt();
} else if ($billing === PAYMENT['BILLING']['ONETIME']) {
$billing_at = date("Y-m-d");
} else {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$billing}에 해당하는 청구방식을 찾을수 없습니다.");
}
return $billing_at;
}
private function setPartTitleByPartEntity(array $formDatas): string
{
$partEntity = $this->getPartService($formDatas['type'])->getEntity($formDatas['part_uid']);
if (!$partEntity instanceof PartEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$formDatas['part_uid']}에 해당하는 파트정보을 찾을수 없습니다.");
}
return $partEntity->getTitle();
}
private function getFormDatasForServerPart(array $formDatas, ServerEntity $serverEntity): array
{ {
if (empty($formDatas['serverinfo_uid'])) { if (empty($formDatas['serverinfo_uid'])) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서버번호가 지정되지 않았습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서버번호가 지정되지 않았습니다.");
@ -61,44 +82,33 @@ class ServerPartService extends EquipmentService
if (empty($formDatas['part_uid'])) { if (empty($formDatas['part_uid'])) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 파트번호가 지정되지 않았습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 파트번호가 지정되지 않았습니다.");
} }
//서버정보 가져오기 //해당 파트정보의 Title을 파트정보의 Title로 설정
$serverEntity = service('equipment_serverservice')->getEntity($formDatas['serverinfo_uid']); $formDatas['title'] = $this->setPartTitleByPartEntity($formDatas);
if (!$serverEntity instanceof ServerEntity) { //청구일 설정
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$formDatas['serverinfo_uid']}에 해당하는 서버정보을 찾을수 없습니다.");
}
//서비스정보 가져오기 //서비스정보 가져오기
$serviceEntity = null; $serviceEntity = null;
if ($serverEntity->getServiceInfoUid()) { if ($serverEntity->getServiceInfoUid()) {
$serviceEntity = service('customer_serviceservice')->getEntity($serverEntity->getServiceInfoUid()); $serviceEntity = service('customer_serviceservice')->getEntity($serverEntity->getServiceInfoUid());
} }
//각 파트정보 가져오기 $formDatas['billing_at'] = null;
$partEntity = $this->getPartService($formDatas['type'])->getEntity($formDatas['part_uid']); if ($serviceEntity instanceof ServiceEntity) {
if (!$serviceEntity instanceof ServiceEntity) { $formDatas['billing_at'] = $this->getBillingAtByServiceEntity($serviceEntity, $formDatas['billing']);
} }
//해당 파트정보에 고객번호,서비스번호 설정 //해당 파트정보에 고객번호,서비스번호 설정
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUid(); $formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUid();
$formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUid(); $formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUid();
//해당 파트정보의 Title을 서버파트정보의 Titlte 설정 return $formDatas;
$formDatas['title'] = $partEntity->getTitle();
//청구방식에 따른 결제일 설정
$formDatas['billing_at'] = null;
if ($formDatas['billing'] === PAYMENT['BILLING']['MONTH']) {
if (!$serviceEntity instanceof ServiceEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 매월결제 상품은 서비스정보가 지정된 후 설정하실 수 있습니다.");
}
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
} elseif ($formDatas['billing'] === PAYMENT['BILLING']['ONETIME']) {
if (!$serviceEntity instanceof ServiceEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 매월결제 상품은 서비스정보가 지정된 후 설정하실 수 있습니다.");
}
$formDatas['billing_at'] = date("Y-m-d");
}
return array($serverEntity, $serviceEntity, $partEntity, $formDatas);
} }
protected function create_process(array $formDatas): CommonEntity protected function create_process(array $formDatas): CommonEntity
{ {
//서버정보 가져오기
$serverEntity = service('equipment_serverservice')->getEntity($formDatas['serverinfo_uid']);
if (!$serverEntity instanceof ServerEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$formDatas['serverinfo_uid']}에 해당하는 서버정보을 찾을수 없습니다.");
}
//생성을 위한 추가 FormDatas설정
$formDatas = $this->getFormDatasForServerPart($formDatas, $serverEntity);
//서버파트 생성 //서버파트 생성
list($serverEntity, $serviceEntity, $partEntity, $formDatas) = $this->getFormDatasForServerPart($formDatas);
$entity = parent::create_process($formDatas); $entity = parent::create_process($formDatas);
if (!$entity instanceof ServerPartEntity) { if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능"); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
@ -106,7 +116,11 @@ class ServerPartService extends EquipmentService
//해당 파트정보를 서버파트정보에 추가 //해당 파트정보를 서버파트정보에 추가
$this->getPartService($entity->getType())->attachToServerPart($entity); $this->getPartService($entity->getType())->attachToServerPart($entity);
//서비스가 정의 되어 있으면 //서비스가 정의 되어 있으면
if ($serviceEntity instanceof ServiceEntity) { if ($entity->getServiceInfoUid()) {
$serviceEntity = service('customer_serviceservice')->getEntity($entity->getServiceInfoUid());
if (!$serviceEntity instanceof ServiceEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUid()}에 해당하는 서비스정보을 찾을수 없습니다.");
}
//Billing형식이 Month이면 서비스 금액설정 호출 //Billing형식이 Month이면 서비스 금액설정 호출
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) { if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) {
service('customer_serviceservice')->updateAmount($serviceEntity); service('customer_serviceservice')->updateAmount($serviceEntity);
@ -120,7 +134,13 @@ class ServerPartService extends EquipmentService
} }
protected function modify_process($entity, array $formDatas): CommonEntity protected function modify_process($entity, array $formDatas): CommonEntity
{ {
list($serverEntity, $serviceEntity, $partEntity, $formDatas) = $this->getFormDatasForServerPart($formDatas); //서버정보 가져오기
$serverEntity = service('equipment_serverservice')->getEntity($formDatas['serverinfo_uid']);
if (!$serverEntity instanceof ServerEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$formDatas['serverinfo_uid']}에 해당하는 서버정보을 찾을수 없습니다.");
}
//수정을 위한 추가 FormDatas설정
$formDatas = $this->getFormDatasForServerPart($formDatas, $serverEntity);
//서버파트 수정 //서버파트 수정
$oldEntity = clone $entity; $oldEntity = clone $entity;
$entity = parent::modify_process($entity, $formDatas); $entity = parent::modify_process($entity, $formDatas);
@ -130,7 +150,11 @@ class ServerPartService extends EquipmentService
//해당 파트정보가 변경 //해당 파트정보가 변경
$this->getPartService($entity->getType())->modifyServerPart($oldEntity, $entity); $this->getPartService($entity->getType())->modifyServerPart($oldEntity, $entity);
//서비스가 정의 되어 있으면 //서비스가 정의 되어 있으면
if ($serviceEntity instanceof ServiceEntity) { if ($entity->getServiceInfoUid()) {
$serviceEntity = service('customer_serviceservice')->getEntity($entity->getServiceInfoUid());
if (!$serviceEntity instanceof ServiceEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUid()}에 해당하는 서비스정보을 찾을수 없습니다.");
}
//Billing형식이 Month이면 서비스 금액설정 호출 //Billing형식이 Month이면 서비스 금액설정 호출
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) { if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) {
service('customer_serviceservice')->updateAmount($serviceEntity); service('customer_serviceservice')->updateAmount($serviceEntity);

View File

@ -127,8 +127,13 @@ class ServerService extends EquipmentService
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServerEntity만 가능"); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
} }
//서버추가시 서버파트 자동추가용 //서버추가시 서버파트 자동추가용
service('part_ipservice')->attachToServer($entity); // dd($entity);
service('part_switchservice')->attachToServer($entity); if ($entity->getIP()) {
service('part_ipservice')->attachToServer($entity);
}
if ($entity->getSwitchInfoUid()) {
service('part_switchservice')->attachToServer($entity);
}
service('equipment_chassisservice')->attachToServer($entity); service('equipment_chassisservice')->attachToServer($entity);
service('equipment_serverpartservice')->attachToServer($entity); service('equipment_serverpartservice')->attachToServer($entity);
return $entity; return $entity;
@ -218,8 +223,12 @@ class ServerService extends EquipmentService
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다.");
} }
//서버파트정보 해제 //서버파트정보 해제
service('part_ipservice')->detachFromServer($entity); if ($entity->getIP()) {
service('part_switchservice')->detachFromServer($entity); service('part_ipservice')->detachFromServer($entity);
}
if ($entity->getSwitchInfoUid()) {
service('part_switchservice')->detachFromServer($entity);
}
service('equipment_serverpartservice')->detachFromServer($entity); service('equipment_serverpartservice')->detachFromServer($entity);
//서버정보 초기화 //서버정보 초기화
$formDatas['serviceinfo_uid'] = null; $formDatas['serviceinfo_uid'] = null;

View File

@ -56,7 +56,7 @@ class SWITCHService extends PartType3Service
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정 //IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
$entity = $this->getEntity($serverEntity->getSwitchInfoUid()); $entity = $this->getEntity($serverEntity->getSwitchInfoUid());
if (!$entity instanceof SWITCHEntity) { if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getSwitchInfoUid()}에 해당하는 IP정보를 찾을수없습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getSwitchInfoUid()}에 해당하는 스위치정보를 찾을수없습니다.");
} }
return $entity; return $entity;
} }