dbms/app/Services/Equipment/ServerService.php
2025-05-20 17:14:59 +09:00

64 lines
1.6 KiB
PHP

<?php
namespace App\Services\Equipment;
use App\Entities\Equipment\ServerEntity;
use App\Models\Equipment\ServerModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Services\Equipment\EquipmentService;
class ServerService extends EquipmentService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
public function getClassName(): string
{
return parent::getClassName() . DIRECTORY_SEPARATOR . "Server";
}
public function getModelClass(): ServerModel
{
return new ServerModel();
}
public function getEntityClass(): ServerEntity
{
return new ServerEntity();
}
public function getFields(): array
{
return [
"code",
"type",
"model",
"status",
"description",
];
}
public function getFilterFields(): array
{
return ["type", 'model', 'status'];
}
public function getBatchJobFields(): array
{
return ["type", 'model', 'status'];
}
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'serverinfo_uid':
foreach ($this->getEntities() as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
// dd($options);
return $options;
}
}