48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment\Part;
|
|
|
|
|
|
use App\Entities\Equipment\ServerEntity;
|
|
use App\Services\Equipment\EquipmentService;
|
|
use CodeIgniter\HTTP\IncomingRequest;
|
|
|
|
abstract class PartService extends EquipmentService
|
|
{
|
|
protected function __construct(?IncomingRequest $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
}
|
|
|
|
abstract protected function getLinkService(): mixed;
|
|
public function getClassName(): string
|
|
{
|
|
return parent::getClassName() . DIRECTORY_SEPARATOR . "Part";
|
|
}
|
|
|
|
public function getFields(): array
|
|
{
|
|
return [
|
|
"model",
|
|
"status",
|
|
];
|
|
}
|
|
public function getFilterFields(): array
|
|
{
|
|
return ['status'];
|
|
}
|
|
public function getBatchJobFields(): array
|
|
{
|
|
return ['status'];
|
|
}
|
|
|
|
final public function getPartEntities(ServerEntity $entity): array
|
|
{
|
|
$entities = [];
|
|
foreach ($this->getLinkService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $linkEntity) {
|
|
$entities[] = $this->getEntity($linkEntity->getPartInfoUID());
|
|
}
|
|
return $entities;
|
|
}
|
|
}
|