dbmsv4 init...1

This commit is contained in:
최준흠 2025-11-19 11:16:04 +09:00
parent 5e47854cbe
commit 3542458ac7
49 changed files with 2422 additions and 103 deletions

View File

@ -13,6 +13,12 @@ use App\Services\Equipment\ServerPartService;
use App\Services\Equipment\ServerService; use App\Services\Equipment\ServerService;
use App\Services\MylogService; use App\Services\MylogService;
use App\Services\Part\CPUService; use App\Services\Part\CPUService;
use App\Services\Part\CSService;
use App\Services\Part\DISKService;
use App\Services\Part\IPService;
use App\Services\Part\RAMService;
use App\Services\Part\SOFTWAREService;
use App\Services\Part\SWITCHService;
use App\Services\PaymentService; use App\Services\PaymentService;
use App\Services\UserService; use App\Services\UserService;
use CodeIgniter\Config\BaseService; use CodeIgniter\Config\BaseService;
@ -213,21 +219,21 @@ class Services extends BaseService
new \App\Models\Part\SWITCHModel(), new \App\Models\Part\SWITCHModel(),
); );
} }
public static function part_ipservice($getShared = true): IPervice public static function part_ipservice($getShared = true): IPService
{ {
if ($getShared) { if ($getShared) {
return static::getSharedInstance(__FUNCTION__); return static::getSharedInstance(__FUNCTION__);
} }
return new IPervice( return new IPService(
new \App\Models\Part\IPModel(), new \App\Models\Part\IPModel(),
); );
} }
public static function part_csservice($getShared = true): CService public static function part_csservice($getShared = true): CSService
{ {
if ($getShared) { if ($getShared) {
return static::getSharedInstance(__FUNCTION__); return static::getSharedInstance(__FUNCTION__);
} }
return new CService( return new CSService(
new \App\Models\Part\CSModel(), new \App\Models\Part\CSModel(),
); );
} }

View File

@ -0,0 +1,250 @@
<?php
namespace App\Controllers\Admin\Part;
use App\Entities\Part\CSEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
class CSController extends PartController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('part_softwareservice');
}
}
protected function action_init_process(string $action): void
{
$fields = [
"type",
"ip",
"accountid",
"domain",
"price",
];
$filters = [
"clientinfo_uid",
'serverinfo_uid',
'type',
'status'
];
$batchjobFilters = ['status'];
// $actionButtons = ['view' => ICONS['SEARCH']];
// $batchjobButtons = [];
parent::action_init_process($action);
switch ($action) {
case 'create':
case 'create_form':
case 'modify':
case 'modify_form':
$fields = [...$fields, 'status'];
break;
case 'view':
$fields = [
...$fields,
"clientinfo_uid",
'serverinfo_uid',
'type',
'ip',
'accountid',
'domain',
'price',
'status',
'created_at'
];
break;
case 'index':
case 'download':
$fields = [
...$fields,
"clientinfo_uid",
'serverinfo_uid',
'type',
'ip',
'accountid',
'domain',
'price',
'status',
'created_at'
];
break;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -0,0 +1,224 @@
<?php
namespace App\Controllers\Admin\Part;
use App\Entities\Part\DISKEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
class DISKController extends PartController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('part_diskservice');
}
}
protected function action_init_process(string $action): void
{
$fields = [
"title",
"price",
"stock",
"format",
];
$filters = [
"status",
];
$batchjobFilters = ['status'];
// $actionButtons = ['view' => ICONS['SEARCH']];
// $batchjobButtons = [];
parent::action_init_process($action);
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;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -0,0 +1,241 @@
<?php
namespace App\Controllers\Admin\Part;
use App\Entities\Part\IPEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
class IPController extends PartController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('part_softwareservice');
}
}
protected function action_init_process(string $action): void
{
$fields = [
"lineinfo_uid",
"ip",
"price",
];
$filters = [
'old_clientinfo_uid',
'clientinfo_uid',
'serverinfo_uid',
"lineinfo_uid",
'status'
];
$batchjobFilters = ['status'];
// $actionButtons = ['view' => ICONS['SEARCH']];
// $batchjobButtons = [];
parent::action_init_process($action);
switch ($action) {
case 'create':
case 'create_form':
case 'modify':
case 'modify_form':
$fields = [...$fields, 'status'];
break;
case 'view':
$fields = [
...$fields,
'clientinfo_uid',
'serverinfo_uid',
'old_clientinfo_uid',
'status',
'created_at'
];
break;
case 'index':
case 'download':
$fields = [
...$fields,
'clientinfo_uid',
'serverinfo_uid',
'old_clientinfo_uid',
'status',
'created_at'
];
break;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -0,0 +1,223 @@
<?php
namespace App\Controllers\Admin\Part;
use App\Entities\Part\RAMEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
class RAMController extends PartController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('part_ramservice');
}
}
protected function action_init_process(string $action): void
{
$fields = [
"title",
"price",
"stock",
];
$filters = [
"status",
];
$batchjobFilters = ['status'];
// $actionButtons = ['view' => ICONS['SEARCH']];
// $batchjobButtons = [];
parent::action_init_process($action);
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;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -0,0 +1,223 @@
<?php
namespace App\Controllers\Admin\Part;
use App\Entities\Part\SOFTWAREEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
class SOFTWAREController extends PartController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('part_softwareservice');
}
}
protected function action_init_process(string $action): void
{
$fields = [
"title",
"price",
"stock",
];
$filters = [
"status",
];
$batchjobFilters = ['status'];
// $actionButtons = ['view' => ICONS['SEARCH']];
// $batchjobButtons = [];
parent::action_init_process($action);
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;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -0,0 +1,244 @@
<?php
namespace App\Controllers\Admin\Part;
use App\Entities\Part\SWITCHEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
class SWITCHController extends PartController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('part_softwareservice');
}
}
protected function action_init_process(string $action): void
{
$fields = [
"code",
"price",
];
$filters = [
'clientinfo_uid',
'serviceinfo_uid',
'serverinfo_uid',
'status'
];
$batchjobFilters = [
'status',
];
// $actionButtons = ['view' => ICONS['SEARCH']];
// $batchjobButtons = [];
parent::action_init_process($action);
switch ($action) {
case 'create':
case 'create_form':
case 'modify':
case 'modify_form':
$fields = [
...$fields,
'status',
];
break;
case 'view':
$fields = [
...$fields,
'clientinfo_uid',
'serviceinfo_uid',
'serverinfo_uid',
'status',
'created_at'
];
break;
case 'index':
case 'download':
$fields = [
...$fields,
'clientinfo_uid',
'serviceinfo_uid',
'serverinfo_uid',
'status',
'created_at'
];
break;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -10,7 +10,7 @@ class CPUDTO extends CommonDTO
public ?string $title = null; public ?string $title = null;
public ?int $price = null; public ?int $price = null;
public ?string $used = null; public ?string $used = null;
public ?int $string = null; public ?int $stock = null;
public ?string $status = null; public ?string $status = null;
public function __construct(array $datas = []) public function __construct(array $datas = [])

29
app/DTOs/Part/CSDTO.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace App\DTOs\Part;
use App\DTOs\CommonDTO;
class CSDTO extends CommonDTO
{
public ?int $uid = null;
public ?int $clientinfo_uid = null;
public ?int $serviceinfo_uid = null;
public ?int $serverinfo_uid = null;
public ?string $type = null;
public ?string $ip = null;
public ?string $accountid = null;
public ?string $domain = null;
public ?int $price = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

26
app/DTOs/Part/DISKDTO.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace App\DTOs\Part;
use App\DTOs\CommonDTO;
class DISKDTO extends CommonDTO
{
public ?int $uid = null;
public ?string $title = null;
public ?int $price = null;
public ?string $used = null;
public ?int $stock = null;
public ?int $format = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

28
app/DTOs/Part/IPDTO.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace App\DTOs\Part;
use App\DTOs\CommonDTO;
class IPDTO extends CommonDTO
{
public ?int $uid = null;
public ?int $lineinfo_uid = null;
public ?int $old_clientinfo_uid = null;
public ?int $clientinfo_uid = null;
public ?int $serviceinfo_uid = null;
public ?int $serverinfo_uid = null;
public ?string $ip = null;
public ?int $price = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

25
app/DTOs/Part/RAMDTO.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\DTOs\Part;
use App\DTOs\CommonDTO;
class RAMDTO extends CommonDTO
{
public ?int $uid = null;
public ?string $title = null;
public ?int $price = null;
public ?string $used = null;
public ?int $stock = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\DTOs\Part;
use App\DTOs\CommonDTO;
class SOFTWAREDTO extends CommonDTO
{
public ?int $uid = null;
public ?string $title = null;
public ?int $price = null;
public ?string $used = null;
public ?int $stock = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\DTOs\Part;
use App\DTOs\CommonDTO;
class SWITCHDTO extends CommonDTO
{
public ?int $uid = null;
public ?int $clientinfo_uid = null;
public ?int $serviceinfo_uid = null;
public ?int $serverinfo_uid = null;
public ?string $code = null;
public ?int $price = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

View File

@ -2,8 +2,6 @@
namespace App\Forms\Part; namespace App\Forms\Part;
use App\Forms\CommonForm;
class CPUForm extends PartForm class CPUForm extends PartForm
{ {
public function __construct() public function __construct()
@ -13,6 +11,9 @@ class CPUForm extends PartForm
public function getFormRule(string $action, string $field): string public function getFormRule(string $action, string $field): string
{ {
switch ($field) { switch ($field) {
case "format":
$rule = "required|numeric";
break;
default: default:
$rule = parent::getFormRule($action, $field); $rule = parent::getFormRule($action, $field);
break; break;

34
app/Forms/Part/CSForm.php Normal file
View File

@ -0,0 +1,34 @@
<?php
namespace App\Forms\Part;
class CSForm extends PartForm
{
public function __construct()
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
switch ($field) {
case "type":
$rule = "required|trim|string";
break;
case "ip":
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
break;
case "accountid":
case "domain":
$rule = "permit_empty|trim|string";
break;
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Forms\Part;
class DISKForm extends PartForm
{
public function __construct()
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
switch ($field) {
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
}

30
app/Forms/Part/IPForm.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace App\Forms\Part;
class IPForm extends PartForm
{
public function __construct()
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
switch ($field) {
case "lineinfo_uid":
$rule = "required|numeric";
break;
case "ip":
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
break;
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -20,7 +20,7 @@ abstract class PartForm extends CommonForm
case "clientinfo_uid": case "clientinfo_uid":
case "serviceinfo_uid": case "serviceinfo_uid":
case "serverinfo_uid": case "serverinfo_uid":
$rule = "permit_empty|trim|string"; $rule = "permit_empty|numeric";
break; break;
case "price": case "price":
case "stock": case "stock":

View File

@ -0,0 +1,20 @@
<?php
namespace App\Forms\Part;
class RAMForm extends PartForm
{
public function __construct()
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
switch ($field) {
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Forms\Part;
class SOFTWAREForm extends PartForm
{
public function __construct()
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
switch ($field) {
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Forms\Part;
class SWITCHForm extends PartForm
{
public function __construct()
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
switch ($field) {
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -2,12 +2,11 @@
namespace App\Helpers; namespace App\Helpers;
use App\Entities\CommonEntity;
use App\Libraries\AuthContext; use App\Libraries\AuthContext;
use App\Traits\UtilTrait; use App\Traits\UtilTrait;
use RuntimeException; use RuntimeException;
class CommonHelper abstract class CommonHelper
{ {
use UtilTrait; use UtilTrait;
private array $_attributes = []; private array $_attributes = [];

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Customer; namespace App\Helpers\Customer;
use App\Helpers\CommonHelper; class AccountHelper extends CustomerHelper
class AccountHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Customer; namespace App\Helpers\Customer;
use App\Helpers\CommonHelper; class ClientHelper extends CustomerHelper
class ClientHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Customer; namespace App\Helpers\Customer;
use App\Helpers\CommonHelper; class CouponHelper extends CustomerHelper
class CouponHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -0,0 +1,13 @@
<?php
namespace App\Helpers\Customer;
use App\Helpers\CommonHelper;
abstract class CustomerHelper extends CommonHelper
{
protected function __construct()
{
parent::__construct();
}
}

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Customer; namespace App\Helpers\Customer;
use App\Helpers\CommonHelper; class PointHelper extends CustomerHelper
class PointHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -0,0 +1,13 @@
<?php
namespace App\Helpers\Equipment;
use App\Helpers\CommonHelper;
abstract class EquipmentHelper extends CommonHelper
{
protected function __construct()
{
parent::__construct();
}
}

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Equipment; namespace App\Helpers\Equipment;
use App\Helpers\CommonHelper; class LineHelper extends EquipmentHelper
class LineHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Equipment; namespace App\Helpers\Equipment;
use App\Helpers\CommonHelper; class ServerHelper extends EquipmentHelper
class ServerHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Equipment; namespace App\Helpers\Equipment;
use App\Helpers\CommonHelper; class ServerPartHelper extends EquipmentHelper
class ServerPartHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -2,9 +2,7 @@
namespace App\Helpers\Part; namespace App\Helpers\Part;
use App\Helpers\CommonHelper; class CPUHelper extends PartHelper
class CPUHelper extends CommonHelper
{ {
public function __construct() public function __construct()
{ {

View File

@ -0,0 +1,11 @@
<?php
namespace App\Helpers\Part;
class CSHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Helpers\Part;
class DISKHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Helpers\Part;
class IPHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Helpers\Part;
use App\Helpers\CommonHelper;
abstract class PartHelper extends CommonHelper
{
protected function __construct()
{
parent::__construct();
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Helpers\Part;
class RAMHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Helpers\Part;
class SOFTWAREHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Helpers\Part;
class SWITCHHelper extends PartHelper
{
public function __construct()
{
parent::__construct();
}
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras);
break;
default:
$action = parent::getListButton($action, $label, $viewDatas, $extras);
break;
}
return $action;
}
}

View File

@ -29,30 +29,4 @@ class CSModel extends PartModel
{ {
parent::__construct(); parent::__construct();
} }
public function getFormRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "type":
$rule = "required|trim|string";
break;
case "ip":
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[" . $this->getTable() . "." . $field . "]" : "";
break;
case "accountid":
case "domain":
$rule = "permit_empty|trim|string";
break;
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
} }

View File

@ -28,32 +28,4 @@ class IPModel extends PartModel
{ {
parent::__construct(); parent::__construct();
} }
public function getFormRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "lineinfo_uid":
$rule = "required|numeric";
break;
case "old_clientinfo_uid":
case "clientinfo_uid":
case "serviceinfo_uid":
case "serverinfo_uid":
$rule = "permit_empty|numeric";
break;
case "ip":
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
} }

View File

@ -27,19 +27,4 @@ class SWITCHModel extends PartModel
{ {
parent::__construct(); parent::__construct();
} }
public function getFormRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
} }

View File

@ -0,0 +1,95 @@
<?php
namespace App\Services\Part;
use App\DTOs\Part\CSDTO;
use App\Entities\Part\CSEntity;
use App\Forms\Part\CSForm;
use App\Helpers\Part\CSHelper;
use App\Models\Part\CSModel;
use RuntimeException;
class CSService extends PartService
{
private $_form = null;
private $_helper = null;
public function __construct(CSModel $model)
{
parent::__construct($model);
$this->addClassPaths('CS');
}
public function createDTO(array $formDatas): CSDTO
{
return new CSDTO($formDatas);
}
public function getFormService(): CSForm
{
if ($this->_form === null) {
$this->_form = new CSForm();
$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(): CSHelper
{
if ($this->_helper === null) {
$this->_helper = new CSHelper();
$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;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): CSEntity
{
return $entity;
}
protected function create_process(array $formDatas): CSEntity
{
return new CSEntity($formDatas);
}
public function create(object $dto): CSEntity
{
if (!$dto instanceof CSDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): CSEntity
{
$entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $entity;
}
public function modify($uid, object $dto): CSEntity
{
if (!$dto instanceof CSDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof CSEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $entity;
}
//List 검색용
//FormFilter 조건절 처리
//검색어조건절처리
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Services\Part;
use App\DTOs\Part\DISKDTO;
use App\Entities\Part\DISKEntity;
use App\Forms\Part\DISKForm;
use App\Helpers\Part\DISKHelper;
use App\Models\Part\DISKModel;
use RuntimeException;
class DISKService extends PartService
{
private $_form = null;
private $_helper = null;
public function __construct(DISKModel $model)
{
parent::__construct($model);
$this->addClassPaths('DISK');
}
public function createDTO(array $formDatas): DISKDTO
{
return new DISKDTO($formDatas);
}
public function getFormService(): DISKForm
{
if ($this->_form === null) {
$this->_form = new DISKForm();
$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(): DISKHelper
{
if ($this->_helper === null) {
$this->_helper = new DISKHelper();
$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;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): DISKEntity
{
return $entity;
}
protected function create_process(array $formDatas): DISKEntity
{
return new DISKEntity($formDatas);
}
public function create(object $dto): DISKEntity
{
if (!$dto instanceof DISKDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): DISKEntity
{
$entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $entity;
}
public function modify($uid, object $dto): DISKEntity
{
if (!$dto instanceof DISKDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof DISKEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $entity;
}
//List 검색용
//FormFilter 조건절 처리
//검색어조건절처리
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Services\Part;
use App\DTOs\Part\IPDTO;
use App\Entities\Part\IPEntity;
use App\Forms\Part\IPForm;
use App\Helpers\Part\IPHelper;
use App\Models\Part\IPModel;
use RuntimeException;
class IPService extends PartService
{
private $_form = null;
private $_helper = null;
public function __construct(IPModel $model)
{
parent::__construct($model);
$this->addClassPaths('IP');
}
public function createDTO(array $formDatas): IPDTO
{
return new IPDTO($formDatas);
}
public function getFormService(): IPForm
{
if ($this->_form === null) {
$this->_form = new IPForm();
$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(): IPHelper
{
if ($this->_helper === null) {
$this->_helper = new IPHelper();
$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;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): IPEntity
{
return $entity;
}
protected function create_process(array $formDatas): IPEntity
{
return new IPEntity($formDatas);
}
public function create(object $dto): IPEntity
{
if (!$dto instanceof IPDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): IPEntity
{
$entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $entity;
}
public function modify($uid, object $dto): IPEntity
{
if (!$dto instanceof IPDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof IPEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $entity;
}
//List 검색용
//FormFilter 조건절 처리
//검색어조건절처리
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Services\Part;
use App\DTOs\Part\RAMDTO;
use App\Entities\Part\RAMEntity;
use App\Forms\Part\RAMForm;
use App\Helpers\Part\RAMHelper;
use App\Models\Part\RAMModel;
use RuntimeException;
class RAMService extends PartService
{
private $_form = null;
private $_helper = null;
public function __construct(RAMModel $model)
{
parent::__construct($model);
$this->addClassPaths('RAM');
}
public function createDTO(array $formDatas): RAMDTO
{
return new RAMDTO($formDatas);
}
public function getFormService(): RAMForm
{
if ($this->_form === null) {
$this->_form = new RAMForm();
$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(): RAMHelper
{
if ($this->_helper === null) {
$this->_helper = new RAMHelper();
$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;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): RAMEntity
{
return $entity;
}
protected function create_process(array $formDatas): RAMEntity
{
return new RAMEntity($formDatas);
}
public function create(object $dto): RAMEntity
{
if (!$dto instanceof RAMDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): RAMEntity
{
$entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $entity;
}
public function modify($uid, object $dto): RAMEntity
{
if (!$dto instanceof RAMDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof RAMEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $entity;
}
//List 검색용
//FormFilter 조건절 처리
//검색어조건절처리
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Services\Part;
use App\DTOs\Part\SOFTWAREDTO;
use App\Entities\Part\SOFTWAREEntity;
use App\Forms\Part\SOFTWAREForm;
use App\Helpers\Part\SOFTWAREHelper;
use App\Models\Part\SOFTWAREModel;
use RuntimeException;
class SOFTWAREService extends PartService
{
private $_form = null;
private $_helper = null;
public function __construct(SOFTWAREModel $model)
{
parent::__construct($model);
$this->addClassPaths('SOFTWARE');
}
public function createDTO(array $formDatas): SOFTWAREDTO
{
return new SOFTWAREDTO($formDatas);
}
public function getFormService(): SOFTWAREForm
{
if ($this->_form === null) {
$this->_form = new SOFTWAREForm();
$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(): SOFTWAREHelper
{
if ($this->_helper === null) {
$this->_helper = new SOFTWAREHelper();
$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;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): SOFTWAREEntity
{
return $entity;
}
protected function create_process(array $formDatas): SOFTWAREEntity
{
return new SOFTWAREEntity($formDatas);
}
public function create(object $dto): SOFTWAREEntity
{
if (!$dto instanceof SOFTWAREDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): SOFTWAREEntity
{
$entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $entity;
}
public function modify($uid, object $dto): SOFTWAREEntity
{
if (!$dto instanceof SOFTWAREDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof SOFTWAREEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $entity;
}
//List 검색용
//FormFilter 조건절 처리
//검색어조건절처리
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Services\Part;
use App\DTOs\Part\SWITCHDTO;
use App\Entities\Part\SWITCHEntity;
use App\Forms\Part\SWITCHForm;
use App\Helpers\Part\SWITCHHelper;
use App\Models\Part\SWITCHModel;
use RuntimeException;
class SWITCHService extends PartService
{
private $_form = null;
private $_helper = null;
public function __construct(SWITCHModel $model)
{
parent::__construct($model);
$this->addClassPaths('SWITCH');
}
public function createDTO(array $formDatas): SWITCHDTO
{
return new SWITCHDTO($formDatas);
}
public function getFormService(): SWITCHForm
{
if ($this->_form === null) {
$this->_form = new SWITCHForm();
$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(): SWITCHHelper
{
if ($this->_helper === null) {
$this->_helper = new SWITCHHelper();
$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;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): SWITCHEntity
{
return $entity;
}
protected function create_process(array $formDatas): SWITCHEntity
{
return new SWITCHEntity($formDatas);
}
public function create(object $dto): SWITCHEntity
{
if (!$dto instanceof SWITCHDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): SWITCHEntity
{
$entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $entity;
}
public function modify($uid, object $dto): SWITCHEntity
{
if (!$dto instanceof SWITCHDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof SWITCHEntity) {
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $entity;
}
//List 검색용
//FormFilter 조건절 처리
//검색어조건절처리
}