46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin\Equipment\Part;
|
|
|
|
use App\Controllers\Admin\Equipment\EquipmentController;
|
|
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
use App\Services\Customer\ClientService;
|
|
|
|
abstract class PartController extends EquipmentController
|
|
{
|
|
private ?ClientService $_clientService = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
}
|
|
final public function getClientService(): ClientService
|
|
{
|
|
if (!$this->_clientService) {
|
|
$this->_clientService = new ClientService($this->request);
|
|
}
|
|
return $this->_clientService;
|
|
}
|
|
|
|
protected function getFormFieldOption(string $field, array $options): array
|
|
{
|
|
switch ($field) {
|
|
case 'clientinfo_uid':
|
|
$temps = [];
|
|
foreach ($this->getClientService()->getEntities() as $entity) {
|
|
$temps[$entity->getPK()] = $entity->getTitle();
|
|
}
|
|
$options[$field] = $temps;
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
return $options;
|
|
}
|
|
//Index,FieldForm관련
|
|
}
|