99 lines
2.5 KiB
PHP
99 lines
2.5 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 $attributes = [
|
|
'clientinfo_uid' => null,
|
|
'part_uid' => null,
|
|
'serverinfo_uid' => null,
|
|
'serviceinfo_uid' => null,
|
|
'title' => '',
|
|
'type' => '',
|
|
'billing' => '',
|
|
'billing_at' => '',
|
|
'cnt' => 0,
|
|
'amount' => 0,
|
|
'extra' => '',
|
|
];
|
|
public function __construct(array|null $data = null)
|
|
{
|
|
parent::__construct($data);
|
|
}
|
|
public function getClientInfoUid(): int|null
|
|
{
|
|
return $this->clientinfo_uid ?? null;
|
|
}
|
|
public function setClientinfoUid($value)
|
|
{
|
|
$this->attributes['clientinfo_uid'] = ($value === '' || $value === null) ? null : (int) $value;
|
|
return $this;
|
|
}
|
|
public function getServiceInfoUid(): int|null
|
|
{
|
|
return $this->serviceinfo_uid ?? null;
|
|
}
|
|
public function setServiceinfoUid($value)
|
|
{
|
|
$this->attributes['serviceinfo_uid'] = ($value === '' || $value === null) ? null : (int) $value;
|
|
return $this;
|
|
}
|
|
public function getServerInfoUid(): int|null
|
|
{
|
|
return $this->serverinfo_uid ?? null;
|
|
}
|
|
public function setServerinfoUid($value)
|
|
{
|
|
$this->attributes['serverinfo_uid'] = ($value === '' || $value === null) ? null : (int) $value;
|
|
return $this;
|
|
}
|
|
public function getPartUid(): int|null
|
|
{
|
|
return $this->part_uid ?? null;
|
|
}
|
|
public function setPartUid($value)
|
|
{
|
|
$this->attributes['part_uid'] = ($value === '' || $value === null) ? null : (int) $value;
|
|
return $this;
|
|
}
|
|
//기본기능용
|
|
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 $this->cnt ?? 0;
|
|
}
|
|
public function getAmount(): int
|
|
{
|
|
return $this->amount ?? 0;
|
|
}
|
|
public function getExtra(): string
|
|
{
|
|
return $this->extra ?? '';
|
|
}
|
|
}
|