65 lines
2.1 KiB
PHP
65 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\DTOs\MylogDTO;
|
|
use App\Entities\MylogEntity;
|
|
use App\Forms\MylogForm;
|
|
use App\Helpers\MylogHelper;
|
|
use App\Models\MylogModel;
|
|
use RuntimeException;
|
|
|
|
class MylogService extends CommonService
|
|
{
|
|
private $_form = null;
|
|
private $_helper = null;
|
|
public function __construct(MylogModel $model)
|
|
{
|
|
parent::__construct($model);
|
|
$this->addClassPaths('Mylog');
|
|
}
|
|
public function getFormService(): MylogForm
|
|
{
|
|
if ($this->_form === null) {
|
|
$this->_form = new MylogForm();
|
|
$this->_form->setAttributes([
|
|
'pk_field' => $this->model->getPKField(),
|
|
'title_field' => $this->model->getTitleField(),
|
|
'table' => $this->model->getTable(),
|
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
'class_path' => $this->getClassPaths(false)
|
|
]);
|
|
}
|
|
return $this->_form;
|
|
}
|
|
public function getHelper(): MylogHelper
|
|
{
|
|
if ($this->_helper === null) {
|
|
$this->_helper = new MylogHelper();
|
|
$this->_helper->setAttributes([
|
|
'pk_field' => $this->model->getPKField(),
|
|
'title_field' => $this->model->getTitleField(),
|
|
'table' => $this->model->getTable(),
|
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
'class_path' => $this->getClassPaths(false)
|
|
]);
|
|
}
|
|
return $this->_helper;
|
|
}
|
|
//기본 기능부분
|
|
public function create(object $dto): MylogEntity
|
|
{
|
|
if (!$dto instanceof MylogDTO) {
|
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
|
}
|
|
return parent::create($dto);
|
|
}
|
|
public function modify($uid, object $dto): MyLogEntity
|
|
{
|
|
if (!$dto instanceof MylogDTO) {
|
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
|
|
}
|
|
return parent::modify($uid, $dto);
|
|
}
|
|
}
|