108 lines
3.3 KiB
PHP
108 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment;
|
|
|
|
use RuntimeException;
|
|
use App\Models\Equipment\LineModel;
|
|
use App\Helpers\Equipment\LineHelper;
|
|
use App\Forms\Equipment\LineForm;
|
|
use App\Entities\Equipment\LineEntity;
|
|
use App\Entities\CommonEntity;
|
|
use App\DTOs\Equipment\LineDTO;
|
|
|
|
class LineService extends EquipmentService
|
|
{
|
|
private $_form = null;
|
|
private $_helper = null;
|
|
public function __construct(LineModel $model)
|
|
{
|
|
parent::__construct($model);
|
|
$this->addClassPaths('Line');
|
|
}
|
|
public function getDTOClass(): string
|
|
{
|
|
return LineDTO::class;
|
|
}
|
|
public function createDTO(array $formDatas): LineDTO
|
|
{
|
|
return new LineDTO($formDatas);
|
|
}
|
|
public function getEntityClass(): string
|
|
{
|
|
return LineEntity::class;
|
|
}
|
|
public function getFormService(): LineForm
|
|
{
|
|
if ($this->_form === null) {
|
|
$this->_form = new LineForm();
|
|
$this->_form->setAttributes([
|
|
'pk_field' => $this->getPKField(),
|
|
'title_field' => $this->getTitleField(),
|
|
'table' => $this->model->getTable(),
|
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
'class_path' => $this->getClassPaths(false)
|
|
]);
|
|
}
|
|
return $this->_form;
|
|
}
|
|
public function getHelper(): LineHelper
|
|
{
|
|
if ($this->_helper === null) {
|
|
$this->_helper = new LineHelper();
|
|
$this->_helper->setAttributes([
|
|
'pk_field' => $this->getPKField(),
|
|
'title_field' => $this->getTitleField(),
|
|
'table' => $this->model->getTable(),
|
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
'class_path' => $this->getClassPaths(false)
|
|
]);
|
|
}
|
|
return $this->_helper;
|
|
}
|
|
public function action_init_process(string $action, array $formDatas = []): void
|
|
{
|
|
$fields = [
|
|
"type",
|
|
"title",
|
|
"bandwith",
|
|
"start_at",
|
|
"end_at",
|
|
];
|
|
$filters = [
|
|
"type",
|
|
"status",
|
|
];
|
|
$indexFilter = $filters;
|
|
$batchjobFilters = ['status'];
|
|
switch ($action) {
|
|
case 'create':
|
|
case 'create_form':
|
|
case 'modify':
|
|
case 'modify_form':
|
|
$fields = [...$fields, 'status'];
|
|
break;
|
|
case 'view':
|
|
$fields = [...$fields, 'status', 'created_at'];
|
|
break;
|
|
case 'index':
|
|
case 'download':
|
|
$fields = [...$fields, 'status', 'created_at'];
|
|
break;
|
|
}
|
|
$this->getFormService()->setFormFields($fields);
|
|
$this->getFormService()->setFormRules($action, $fields);
|
|
$this->getFormService()->setFormFilters($filters);
|
|
$this->getFormService()->setFormOptions($action, $filters, $formDatas);
|
|
$this->getFormService()->setIndexFilters($indexFilter);
|
|
$this->getFormService()->setBatchjobFilters($batchjobFilters);
|
|
}
|
|
//기본 기능부분
|
|
protected function getEntity_process(mixed $entity): LineEntity
|
|
{
|
|
return $entity;
|
|
}
|
|
//List 검색용
|
|
//FormFilter 조건절 처리
|
|
//검색어조건절처리
|
|
}
|