70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Entities\Equipment;
|
|
|
|
use App\Entities\Equipment\ServerPartEntity;
|
|
use App\Models\Equipment\ServerModel;
|
|
|
|
class ServerEntity extends EquipmentEntity
|
|
{
|
|
const PK = ServerModel::PK;
|
|
const TITLE = ServerModel::TITLE;
|
|
const STATUS_AVAILABLE = "available";
|
|
const STATUS_OCCUPIED = "occupied";
|
|
const STATUS_FORBIDDEN = "forbidden";
|
|
const DEFAULT_STATUS = self::STATUS_AVAILABLE;
|
|
|
|
public function addServerPartEntity(string $partType, ServerPartEntity $entity): void
|
|
{
|
|
if (!array_key_exists('serverPartEntities', $this->attributes)) {
|
|
$this->attributes['serverPartEntities'] = [];
|
|
}
|
|
$this->attributes['serverPartEntities'][$partType] = $entity;
|
|
}
|
|
public function getServerPartEntity(string $partType): ServerPartEntity|null
|
|
{
|
|
if (!array_key_exists('serverPartEntities', $this->attributes)) {
|
|
return null;
|
|
}
|
|
if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) {
|
|
return null;
|
|
}
|
|
return $this->attributes['serverPartEntities'][$partType];
|
|
}
|
|
public function addIPEntity(IPEntity $entity): void
|
|
{
|
|
if (!array_key_exists('ipEntities', $this->attributes)) {
|
|
$this->attributes['ipEntities'] = [];
|
|
}
|
|
$this->attributes['ipEntities'][] = $entity;
|
|
}
|
|
public function getIPEntities(): array
|
|
{
|
|
return $this->attributes['ipEntities'] ?? [];
|
|
}
|
|
public function addCSEntity(CSEntity $entity): void
|
|
{
|
|
if (!array_key_exists('csEntities', $this->attributes)) {
|
|
$this->attributes['csEntities'] = [];
|
|
}
|
|
$this->attributes['csEntities'] = $entity;
|
|
}
|
|
public function getCSEntities(): array
|
|
{
|
|
return $this->attributes['csEntities'] ?? [];
|
|
}
|
|
//기본기능용
|
|
public function getCode(): string
|
|
{
|
|
return $this->attributes['code'];
|
|
}
|
|
public function getClientInfoUID(): int|null
|
|
{
|
|
return $this->attributes['clientinfo_uid'] ?? null;
|
|
}
|
|
public function getServiceInfoUID(): int|null
|
|
{
|
|
return $this->attributes['serviceinfo_uid'] ?? null;
|
|
}
|
|
}
|