cfmgrv4/app/Services/MapurlService.php
2025-03-14 11:39:06 +09:00

44 lines
1.2 KiB
PHP

<?php
namespace App\Services;
use App\Models\MapurlModel;
use App\Entities\MapurlEntity;
use App\Traits\MylogTrait;
class MapurlService extends CommonService
{
use MylogTrait;
private ?MapurlModel $_model = null;
public function __construct()
{
parent::__construct("Mapurl", "Mapurl");
}
public function getModel(): MapurlModel
{
if ($this->_model === null) {
$this->_model = new MapurlModel();
}
return $this->_model;
}
public function create(array $formDatas): MapurlEntity
{
$entity = $this->getModel()->create($formDatas);
//생성값 formDatas Log남기기
$this->add_MylogTrait(__FUNCTION__, $formDatas, $entity);
return $entity;
}
public function modify(MapurlEntity $entity, array $formDatas): MapurlEntity
{
//변경전 entity 값, 변경값 formDatas Log남기기
$this->add_MylogTrait(__FUNCTION__, $formDatas, $entity);
return $this->getModel()->modify($entity, $formDatas);
}
public function delete(MapurlEntity $entity): void
{
//삭제전 entity 값 Log남기기
$this->add_MylogTrait(__FUNCTION__, [], $entity);
$this->getModel()->delete($entity->getPK());
}
}