dbmsv4/app/Entities/Equipment/CHASSISEntity.php
2026-02-04 11:18:22 +09:00

75 lines
1.6 KiB
PHP

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