dbmsv4/app/Entities/Equipment/ServerPartEntity.php
2026-02-26 13:07:07 +09:00

80 lines
1.8 KiB
PHP

<?php
namespace App\Entities\Equipment;
use App\Models\Equipment\ServerPartModel;
class ServerPartEntity extends EquipmentEntity
{
const PK = ServerPartModel::PK;
const TITLE = ServerPartModel::TITLE;
protected array $nullableFields = [
'clientinfo_uid',
'part_uid',
'serviceinfo_uid',
'billing_at',
'extra',
];
public function __construct(array|null $data = null)
{
parent::__construct($data);
$this->nullableFields = [
...$this->nullableFields,
'clientinfo_uid',
'part_uid',
'serviceinfo_uid',
'billing_at',
'extra',
];
}
public function getClientInfoUid(): ?int
{
return $this->clientinfo_uid;
}
public function getServiceInfoUid(): ?int
{
return $this->serviceinfo_uid;
}
public function getServerInfoUid(): int
{
return $this->serverinfo_uid;
}
public function getPartUid(): ?int
{
return $this->part_uid;
}
//기본기능용
public function getCustomTitle(): string
{
return sprintf("%s*%d개[%s]", $this->getTitle(), $this->getCnt(), $this->getExtra());
}
public function getCalculatedAmount(): int
{
return $this->getAmount() * $this->getCnt();
}
public function getType(): string
{
return $this->type;
}
public function getBilling(): string
{
return $this->billing;
}
public function getBillingAt(): ?string
{
return $this->billing_at;
}
public function getCnt(): int
{
return (int) ($this->cnt ?? 0);
}
public function getAmount(): int
{
return (int) ($this->amount ?? 0);
}
public function getExtra(): ?string
{
return $this->extra;
}
}