45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment\Link;
|
|
|
|
|
|
use App\Services\Equipment\EquipmentService;
|
|
use CodeIgniter\HTTP\IncomingRequest;
|
|
|
|
use App\Entities\Equipment\ServerEntity;
|
|
|
|
abstract class LinkService extends EquipmentService
|
|
{
|
|
protected function __construct(?IncomingRequest $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
$this->addClassName('Link');
|
|
}
|
|
abstract protected function getAdapterService(): mixed;
|
|
abstract protected function getAdapterField(): string;
|
|
final public function getPartEntities(ServerEntity $serverEntity): array
|
|
{
|
|
$entities = [];
|
|
foreach ($this->getEntities(['serverinfo_uid' => $serverEntity->getPK()]) as $entity) {
|
|
$entities[] = $this->getAdapterService()->getEntity($entity->getPartInfoUID());
|
|
}
|
|
return $entities;
|
|
}
|
|
|
|
public function getFields(): array
|
|
{
|
|
return [
|
|
"serverinfo_uid",
|
|
$this->getAdapterField(),
|
|
];
|
|
}
|
|
public function getFilterFields(): array
|
|
{
|
|
return ["serverinfo_uid", $this->getAdapterField()];
|
|
}
|
|
public function getBatchJobFields(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|