62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Entities\Customer;
|
|
|
|
use App\Entities\Equipment\ServerEntity;
|
|
use App\Entities\Equipment\SwitchEntity;
|
|
use App\Models\Customer\ServiceModel;
|
|
|
|
class ServiceEntity extends CustomerEntity
|
|
{
|
|
const PK = ServiceModel::PK;
|
|
const TITLE = ServiceModel::TITLE;
|
|
const STATUS_NORMAL = "normal";
|
|
const STATUS_PAUSE = "pause";
|
|
const STATUS_TERMINATED = "terminated";
|
|
const DEFAULT_STATUS = self::STATUS_NORMAL;
|
|
public function setServerEntity(ServerEntity|null $entity): void
|
|
{
|
|
$this->attributes['serverEntity'] = $entity;
|
|
}
|
|
public function getServerEntity(): ServerEntity|null
|
|
{
|
|
if (!array_key_exists('serverEntity', $this->attributes)) {
|
|
return null;
|
|
}
|
|
return $this->attributes['serverEntity'];
|
|
}
|
|
public function getCode(): string
|
|
{
|
|
return $this->attributes['code'] ?? "null";
|
|
}
|
|
final public function getUserUID(): int
|
|
{
|
|
return intval($this->attributes['user_uid']);
|
|
}
|
|
final public function getClientInfoUID(): int
|
|
{
|
|
return intval($this->attributes['clientinfo_uid']);
|
|
}
|
|
public function getSwitchCode(): string
|
|
{
|
|
return $this->attributes['switchinfo_code'];
|
|
}
|
|
public function getType(): string
|
|
{
|
|
return $this->attributes['type'];
|
|
}
|
|
final public function getBillingAt(): string
|
|
{
|
|
return $this->attributes['billing_at'];
|
|
}
|
|
public function getItemEntities(string $type): array
|
|
{
|
|
return $this->attributes[$type] ?? [];
|
|
}
|
|
public function setItemEntities(string $type, array $itemEntities): void
|
|
{
|
|
$this->attributes[$type] = $itemEntities;
|
|
// $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR);
|
|
}
|
|
}
|