dbmsv4 init...3

This commit is contained in:
최준흠 2025-12-15 13:33:28 +09:00
parent 4d413e29ca
commit c7549e826d
26 changed files with 131 additions and 112 deletions

View File

@ -108,6 +108,7 @@ abstract class AbstractCRUDController extends AbstractWebController
protected function modify_process($uid, array $formDatas): object protected function modify_process($uid, array $formDatas): object
{ {
// POST 데이터를 DTO 객체로 변환 // POST 데이터를 DTO 객체로 변환
$formDatas[$this->service->getPKField()] = $uid;
$dto = $this->service->createDTO($formDatas); $dto = $this->service->createDTO($formDatas);
//DTO 타입 체크 로직을 일반화 //DTO 타입 체크 로직을 일반화
$dtoClass = $this->service->getDTOClass(); $dtoClass = $this->service->getDTOClass();

View File

@ -27,7 +27,7 @@ abstract class CommonController extends AbstractCRUDController
unset($postDatas['batchjob_uids'], $postDatas['batchjob_submit']); //formDatas에 포함되지 않게하기위함 unset($postDatas['batchjob_uids'], $postDatas['batchjob_submit']); //formDatas에 포함되지 않게하기위함
$formDatas = array_filter($postDatas, fn($value) => $value !== "" && $value !== null); $formDatas = array_filter($postDatas, fn($value) => $value !== "" && $value !== null);
if (empty($formDatas)) { if (empty($formDatas)) {
throw new RuntimeException("{$this->getTitle()}에서 일괄작업에 변경할 조건항목을 선택하셔야합니다."); throw new RuntimeException(message: "{$this->getTitle()}에서 일괄작업에 변경할 조건항목을 선택하셔야합니다.");
} }
// 3. 데이터가 있는 필드 추출 // 3. 데이터가 있는 필드 추출
return array($uids, $formDatas); return array($uids, $formDatas);

View File

@ -27,8 +27,8 @@ abstract class AuthService extends CommonService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new AuthHelper(); $this->_helper = new AuthHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
]); ]);
} }

View File

@ -31,8 +31,8 @@ class GoogleService extends AuthService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new GoogleForm(); $this->_form = new GoogleForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false), 'class_path' => $this->getClassPaths(false),

View File

@ -30,8 +30,8 @@ class LocalService extends AuthService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new LocalForm(); $this->_form = new LocalForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false), 'class_path' => $this->getClassPaths(false),

View File

@ -34,8 +34,8 @@ class BoardService extends CommonService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new BoardForm(); $this->_form = new BoardForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -48,8 +48,8 @@ class BoardService extends CommonService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new BoardHelper(); $this->_helper = new BoardHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,13 +37,22 @@ abstract class CommonService
{ {
$this->_classPaths[] = $path; $this->_classPaths[] = $path;
} }
final public function getPKField(): string
{
return $this->model->getPKField();
}
final public function getTitleField(): string
{
return $this->model->getTitleField();
}
final public function getClassPaths($isArray = true, $delimeter = DIRECTORY_SEPARATOR): array|string final public function getClassPaths($isArray = true, $delimeter = DIRECTORY_SEPARATOR): array|string
{ {
return $isArray ? $this->_classPaths : implode($delimeter, $this->_classPaths); return $isArray ? $this->_classPaths : implode($delimeter, $this->_classPaths);
} }
final public function getNextPK(): int final public function getNextPK(): int
{ {
$pkField = $this->model->getPKField(); $pkField = $this->getPKField();
$row = $this->model->selectMax($pkField)->get()->getRow(); $row = $this->model->selectMax($pkField)->get()->getRow();
return isset($row->{$pkField}) ? ((int)$row->{$pkField} + 1) : 1; return isset($row->{$pkField}) ? ((int)$row->{$pkField} + 1) : 1;
} }
@ -160,7 +169,7 @@ abstract class CommonService
$result = $this->model->save($entity); $result = $this->model->save($entity);
log_message('debug', $this->model->getLastQuery()); log_message('debug', $this->model->getLastQuery());
// 최종적으로 DB에 반영된 PK를 반환받습니다. (UPDATE이면 기존 PK, INSERT이면 새 PK) // 최종적으로 DB에 반영된 PK를 반환받습니다. (UPDATE이면 기존 PK, INSERT이면 새 PK)
$entity->{$this->model->getPKField()} = $this->handle_save_result($result, $initialPK); $entity->{$this->getPKField()} = $this->handle_save_result($result, $initialPK);
// handle_save_result에서 확인된 최종 PK를 사용하여 DB에서 최신 엔티티를 가져옴 // handle_save_result에서 확인된 최종 PK를 사용하여 DB에서 최신 엔티티를 가져옴
return $entity; return $entity;
} }
@ -168,8 +177,6 @@ abstract class CommonService
//생성용 //생성용
protected function create_process(array $formDatas): object protected function create_process(array $formDatas): object
{ {
//관리자 정보추가용
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
// 데이터 검증 // 데이터 검증
if (!$this->getFormService()->validate($formDatas)) { if (!$this->getFormService()->validate($formDatas)) {
throw new ValidationException(implode("\n", service('validation')->getErrors())); throw new ValidationException(implode("\n", service('validation')->getErrors()));
@ -192,6 +199,8 @@ abstract class CommonService
try { try {
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정 //트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
$db->transException(true)->transStart(); $db->transException(true)->transStart();
//관리자 정보추가용
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
$entity = $this->create_process($formDatas); $entity = $this->create_process($formDatas);
$db->transComplete(); $db->transComplete();
return $entity; return $entity;
@ -215,8 +224,6 @@ abstract class CommonService
$fields = array_keys($formDatas); $fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields); $this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields); $this->getFormService()->setFormRules('modify', $fields);
//관리자 정보추가용
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
// 데이터 검증 // 데이터 검증
if (!$this->getFormService()->validate($formDatas)) { if (!$this->getFormService()->validate($formDatas)) {
throw new ValidationException( throw new ValidationException(
@ -224,7 +231,7 @@ abstract class CommonService
); );
} }
//PK 추가 //PK 추가
$pkField = $this->model->getPKField(); $pkField = $this->getPKField();
if (!isset($formDatas[$pkField]) && !empty($entity->getPK())) { if (!isset($formDatas[$pkField]) && !empty($entity->getPK())) {
// original에 있는 PK 값을 attributes에 명시적으로 복사합니다. // original에 있는 PK 값을 attributes에 명시적으로 복사합니다.
$formDatas[$pkField] = $entity->getPK(); $formDatas[$pkField] = $entity->getPK();
@ -255,6 +262,8 @@ abstract class CommonService
if (!$entity instanceof $entityClass) { if (!$entity instanceof $entityClass) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능"); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
} }
//관리자 정보추가용
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
$entity = $this->modify_process($entity, $formDatas); $entity = $this->modify_process($entity, $formDatas);
// 트랜잭션 완료 및 커밋 // 트랜잭션 완료 및 커밋
$db->transComplete(); $db->transComplete();
@ -296,6 +305,8 @@ abstract class CommonService
if (!$entity instanceof $entityClass) { if (!$entity instanceof $entityClass) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능"); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
} }
//관리자 정보추가용
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
$entities[] = $this->modify_process($entity, $formDatas); $entities[] = $this->modify_process($entity, $formDatas);
} }
return $entities; return $entities;
@ -421,7 +432,7 @@ abstract class CommonService
//검색어조건절처리 //검색어조건절처리
public function setSearchWord(string $word): void public function setSearchWord(string $word): void
{ {
$this->model->orLike($this->model->getTable() . "." . $this->model->getTitleField(), $word, 'both'); $this->model->orLike($this->model->getTable() . "." . $this->getTitleField(), $word, 'both');
} }
//날자검색 //날자검색
public function setDateFilter(string $start, string $end): void public function setDateFilter(string $start, string $end): void
@ -435,7 +446,7 @@ abstract class CommonService
if ($field !== null && $value !== null) { if ($field !== null && $value !== null) {
$this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $field, $value)); $this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $field, $value));
} else { } else {
$this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $this->model->getPKField(), "DESC")); $this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $this->getPKField(), "DESC"));
} }
} }
} }

View File

@ -36,8 +36,8 @@ class ClientService extends CustomerService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new ClientForm(); $this->_form = new ClientForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -50,8 +50,8 @@ class ClientService extends CustomerService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new ClientHelper(); $this->_helper = new ClientHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -38,8 +38,8 @@ class ServiceService extends CustomerService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new ServiceForm(); $this->_form = new ServiceForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -52,8 +52,8 @@ class ServiceService extends CustomerService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new ServiceHelper(); $this->_helper = new ServiceHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -234,7 +234,7 @@ class ServiceService extends CustomerService
//서버정보 연결 신규서버로 변경 //서버정보 연결 신규서버로 변경
if ($oldEntity->getServerInfoUID() !== $entity->getServerInfoUID()) { if ($oldEntity->getServerInfoUID() !== $entity->getServerInfoUID()) {
//기존서버는 대체서버로 변경 //기존서버는 대체서버로 변경
service('equipment_serverservice')->modifyByService($oldEntity->getServerInfoUID()); service('equipment_serverservice')->modifyByService($oldEntity, $entity);
//신규서버는 메인서버로 추가 //신규서버는 메인서버로 추가
service('equipment_serverservice')->attatchToService($entity, $entity->getServerInfoUID()); service('equipment_serverservice')->attatchToService($entity, $entity->getServerInfoUID());
} }

View File

@ -38,8 +38,8 @@ class AccountService extends WalletService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new AccountForm(); $this->_form = new AccountForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -52,8 +52,8 @@ class AccountService extends WalletService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new AccountHelper(); $this->_helper = new AccountHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,8 +37,8 @@ class CouponService extends WalletService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new CouponForm(); $this->_form = new CouponForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -51,8 +51,8 @@ class CouponService extends WalletService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new CouponHelper(); $this->_helper = new CouponHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,8 +37,8 @@ class PointService extends WalletService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new PointForm(); $this->_form = new PointForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -51,8 +51,8 @@ class PointService extends WalletService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new PointHelper(); $this->_helper = new PointHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -36,8 +36,8 @@ class CHASSISService extends EquipmentService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new CHASSISForm(); $this->_form = new CHASSISForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -50,8 +50,8 @@ class CHASSISService extends EquipmentService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new CHASSISHelper(); $this->_helper = new CHASSISHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -36,8 +36,8 @@ class LineService extends EquipmentService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new LineForm(); $this->_form = new LineForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -50,8 +50,8 @@ class LineService extends EquipmentService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new LineHelper(); $this->_helper = new LineHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -38,8 +38,8 @@ class ServerPartService extends EquipmentService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new ServerPartForm(); $this->_form = new ServerPartForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -52,8 +52,8 @@ class ServerPartService extends EquipmentService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new ServerPartHelper(); $this->_helper = new ServerPartHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -36,8 +36,8 @@ class ServerService extends EquipmentService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new ServerForm(); $this->_form = new ServerForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -50,8 +50,8 @@ class ServerService extends EquipmentService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new ServerHelper(); $this->_helper = new ServerHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -264,45 +264,52 @@ class ServerService extends EquipmentService
//OrderBy 처리 //OrderBy 처리
//서비스관련 //서비스관련
public function attatchToService(ServiceEntity $serviceEntity, $uid): void public function attatchToService(ServiceEntity $serviceEntity, $uid, array $formDatas = []): void
{ {
$entity = $this->getEntity($uid); $entity = $this->getEntity($uid);
if (!$entity instanceof ServerEntity) { if (!$entity instanceof ServerEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다.");
} }
$formDatas = [];
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK(); $formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID(); $formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID();
$formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED']; $formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED'];
parent::modify_process($entity, $formDatas); parent::modify_process($entity, $formDatas);
} }
public function modifyByService($uid): void public function modifyByService(ServiceENtity $oldServiceEntity, ServiceEntity $serviceEntity, array $formDatas = []): void
{ {
$entity = $this->getEntity($uid); //기존 메인서버 정보를 대체서버로 변경
if (!$entity instanceof ServerEntity) { $oldEntity = $this->getEntity($oldServiceEntity->getServerInfoUID());
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다."); if (!$oldEntity instanceof ServerEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$oldServiceEntity->getServerInfoUID()}에 해당하는 서비스의 기존 메인 서버정보을 찾을수 없습니다.");
} }
$formDatas = []; //기존서버는 대체서버로 변경
$formDatas['type'] = 'alternative'; parent::modify_process($oldEntity, ['type' => 'alternative']);
//신규 메인서버 설정
$entity = $this->getEntity($serviceEntity->getServerInfoUID());
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$serviceEntity->getServerInfoUID()}에 해당하는 서비스의 신규 메인 서버정보을 찾을수 없습니다.");
}
//신규 메인서버는 기존 메인서버의 타입으로 설정
$formDatas['type'] = $oldEntity->getType();
parent::modify_process($entity, $formDatas); parent::modify_process($entity, $formDatas);
} }
//해지처리 //해지처리
public function deatchFromService($uid): void public function deatchFromService($uid, array $formDatas = []): void
{ {
$entity = $this->getEntity($uid); $entity = $this->getEntity($uid);
if (!$entity instanceof ServerEntity) { if (!$entity instanceof ServerEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다.");
} }
$formDatas = []; //서버파트정보 해제
service('part_ipservice')->detachFromServer($entity);
service('part_switchservice')->detachFromServer($entity);
service('equipment_serverpartservice')->detachFromServer($entity);
//서버정보 초기화
$formDatas['serviceinfo_uid'] = NULL; $formDatas['serviceinfo_uid'] = NULL;
$formDatas["clientinfo_uid"] = NULL; $formDatas["clientinfo_uid"] = NULL;
$formDatas["switchinfo_uid"] = NULL; $formDatas["switchinfo_uid"] = NULL;
$formDatas["ip"] = NULL; $formDatas["ip"] = NULL;
$formDatas['status'] = $formDatas['status'] ?? STATUS['AVAILABLE']; $formDatas['status'] = $formDatas['status'] ?? STATUS['AVAILABLE'];
parent::modify_process($entity, $formDatas); parent::modify_process($entity, $formDatas);
//서버파트정보처리
service('part_ipservice')->detachFromServer($entity);
service('part_switchservice')->detachFromServer($entity);
service('equipment_serverpartservice')->detachFromServer($entity);
} }
} }

View File

@ -36,8 +36,8 @@ class MylogService extends CommonService implements PipelineStepInterface
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new MylogForm(); $this->_form = new MylogForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -77,8 +77,8 @@ class MylogService extends CommonService implements PipelineStepInterface
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new MylogHelper(); $this->_helper = new MylogHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -36,8 +36,8 @@ class CPUService extends PartType1Service
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new CPUForm(); $this->_form = new CPUForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -50,8 +50,8 @@ class CPUService extends PartType1Service
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new CPUHelper(); $this->_helper = new CPUHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,8 +37,8 @@ class CSService extends PartType2Service
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new CSForm(); $this->_form = new CSForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -51,8 +51,8 @@ class CSService extends PartType2Service
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new CSHelper(); $this->_helper = new CSHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,8 +37,8 @@ class DISKService extends PartType1Service
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new DISKForm(); $this->_form = new DISKForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -51,8 +51,8 @@ class DISKService extends PartType1Service
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new DISKHelper(); $this->_helper = new DISKHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,8 +37,8 @@ class IPService extends PartType3Service
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new IPForm(); $this->_form = new IPForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -51,8 +51,8 @@ class IPService extends PartType3Service
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new IPHelper(); $this->_helper = new IPHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,8 +37,8 @@ class RAMService extends PartType1Service
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new RAMForm(); $this->_form = new RAMForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -51,8 +51,8 @@ class RAMService extends PartType1Service
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new RAMHelper(); $this->_helper = new RAMHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -37,8 +37,8 @@ class SOFTWAREService extends PartType1Service
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new SOFTWAREForm(); $this->_form = new SOFTWAREForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -85,8 +85,8 @@ class SOFTWAREService extends PartType1Service
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new SOFTWAREHelper(); $this->_helper = new SOFTWAREHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -38,8 +38,8 @@ class SWITCHService extends PartType3Service
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new SWITCHForm(); $this->_form = new SWITCHForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -52,8 +52,8 @@ class SWITCHService extends PartType3Service
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new SWITCHHelper(); $this->_helper = new SWITCHHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -41,8 +41,8 @@ class PaymentService extends CommonService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new PaymentForm(); $this->_form = new PaymentForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -55,8 +55,8 @@ class PaymentService extends CommonService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new PaymentHelper(); $this->_helper = new PaymentHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)

View File

@ -36,8 +36,8 @@ class UserService extends CommonService
if ($this->_form === null) { if ($this->_form === null) {
$this->_form = new UserForm(); $this->_form = new UserForm();
$this->_form->setAttributes([ $this->_form->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)
@ -50,8 +50,8 @@ class UserService extends CommonService
if ($this->_helper === null) { if ($this->_helper === null) {
$this->_helper = new UserHelper(); $this->_helper = new UserHelper();
$this->_helper->setAttributes([ $this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(), 'pk_field' => $this->getPKField(),
'title_field' => $this->model->getTitleField(), 'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(), 'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(), 'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false) 'class_path' => $this->getClassPaths(false)