dbmsv4 init...4

This commit is contained in:
최준흠 2026-01-06 13:09:07 +09:00
parent daf9e0a894
commit 3c9d6d78d1
27 changed files with 233 additions and 818 deletions

View File

@ -31,4 +31,8 @@ class UserSNSEntity extends CommonEntity
{
return $this->attributes['email'];
}
public function getParent(): int|string
{
return $this->attributes['user_uid'];
}
}

View File

@ -92,7 +92,8 @@ abstract class CommonForm
}
final public function setIndexFilters(array $fields): void
{
$this->_indexFilters = $fields;;
$this->_indexFilters = $fields;
;
}
final public function getIndexFilters(): array
{
@ -100,7 +101,8 @@ abstract class CommonForm
}
final public function setBatchjobFilters(array $fields): void
{
$this->_batchjobFilters = $fields;;
$this->_batchjobFilters = $fields;
;
}
final public function getBatchjobFilters(): array
{
@ -136,9 +138,15 @@ abstract class CommonForm
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: Validation 서비스가 초기화되지 않았습니다.");
}
try {
$dynamicRules = [];
try {
// 0. Ensure all scalar inputs are strings to prevent trim() error on PHP 8.1+
foreach ($formDatas as $key => $value) {
if (is_scalar($value) && !is_string($value)) {
$formDatas[$key] = (string) $value;
}
}
// 1. 현재 서비스의 필드 라벨 정보 로드 (언어 파일 기반)
$formFields = $this->getFormFields();
$formRules = $this->getFormRules();

View File

@ -23,6 +23,7 @@ abstract class PartForm extends CommonForm
break;
case "price":
case "stock":
case "used":
$formRules[$field] = "required|numeric";
break;
case "status":

View File

@ -11,7 +11,8 @@ use App\Services\CommonService;
abstract class AuthService extends CommonService
{
private $_helper = null;
protected string $helperClass = AuthHelper::class;
protected function __construct(CommonModel $model)
{
parent::__construct($model);
@ -21,19 +22,6 @@ abstract class AuthService extends CommonService
{
return UserEntity::class;
}
abstract public function getFormService(): mixed;
final public function getHelper(): AuthHelper
{
if ($this->_helper === null) {
$this->_helper = new AuthHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//로그인
abstract protected function login_process(array $formDatas): UserEntity;
final public function login(LocalDTO|GoogleDTO $dto): UserEntity

View File

@ -11,7 +11,8 @@ use CodeIgniter\Exceptions\PageNotFoundException;
class GoogleService extends AuthService
{
private $_form = null;
protected string $formClass = GoogleForm::class;
public function __construct(UserModel $model, private CURL $socket)
{
parent::__construct($model);
@ -25,20 +26,6 @@ class GoogleService extends AuthService
{
return GoogleDTO::class;
}
public function getFormService(): GoogleForm
{
if ($this->_form === null) {
$this->_form = new GoogleForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false),
]);
}
return $this->_form;
}
protected function getEntity_process(mixed $entity): UserEntity
{
return $entity;

View File

@ -10,7 +10,8 @@ use RuntimeException;
class LocalService extends AuthService
{
private $_form = null;
protected string $formClass = LocalForm::class;
public function __construct(UserModel $model)
{
parent::__construct($model);
@ -24,20 +25,6 @@ class LocalService extends AuthService
{
return LocalDTO::class;
}
public function getFormService(): LocalForm
{
if ($this->_form === null) {
$this->_form = new LocalForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false),
]);
}
return $this->_form;
}
protected function getEntity_process(mixed $entity): UserEntity
{
return $entity;

View File

@ -10,8 +10,9 @@ use App\DTOs\BoardDTO;
class BoardService extends CommonService
{
private $_form = null;
private $_helper = null;
protected string $formClass = BoardForm::class;
protected string $helperClass = BoardHelper::class;
public function __construct(BoardModel $model)
{
parent::__construct($model);
@ -29,47 +30,11 @@ class BoardService extends CommonService
{
return BoardEntity::class;
}
public function getFormService(): BoardForm
{
if ($this->_form === null) {
$this->_form = new BoardForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): BoardHelper
{
if ($this->_helper === null) {
$this->_helper = new BoardHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): BoardEntity
{
return $entity;
}
protected function create_process(array $formDatas): BoardEntity
{
return parent::create_process($formDatas);
}
protected function modify_process($entity, array $formDatas): BoardEntity
{
return parent::modify_process($entity, $formDatas);
}
//List 검색용
//FormFilter 조건절 처리
//검색어조건절처리

View File

@ -18,12 +18,80 @@ abstract class CommonService
private ?AuthContext $_authContext = null;
private array $_classPaths = [];
protected $title = null;
protected function __construct(protected CommonModel $model) {}
protected ?object $_form = null;
protected ?object $_helper = null;
protected string $formClass = '';
protected string $helperClass = '';
protected function __construct(protected CommonModel $model)
{
}
abstract public function getDTOClass(): string;
abstract public function createDTO(array $formDatas): CommonDTO;
abstract public function getEntityClass(): string;
abstract public function getFormService(): mixed;
abstract public function getHelper(): mixed;
/**
* 공통 트랜잭션 래퍼
*/
final protected function dbTransaction(callable $callback, string $functionName = ''): mixed
{
$db = \Config\Database::connect();
try {
$db->transException(true)->transStart();
$result = $callback($db);
$db->transComplete();
return $result;
} catch (DatabaseException $e) {
$errorMessage = sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
static::class . '->' . ($functionName ?: 'dbTransaction'),
$this->model->getLastQuery() ?? "No Query Available",
$e->getMessage()
);
log_message('error', $errorMessage);
throw new RuntimeException($errorMessage, $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback();
throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
}
}
public function getFormService(): mixed
{
if ($this->_form === null && $this->formClass) {
$this->_form = new $this->formClass();
if (method_exists($this->_form, 'setAttributes')) {
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
}
return $this->_form;
}
public function getHelper(): mixed
{
if ($this->_helper === null && $this->helperClass) {
$this->_helper = new $this->helperClass();
if (method_exists($this->_helper, 'setAttributes')) {
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
}
return $this->_helper;
}
final public function getAuthContext(): AuthContext
{
if ($this->_authContext === null) {
@ -179,10 +247,10 @@ abstract class CommonService
protected function create_process(array $formDatas): CommonEntity
{
try {
$this->getFormService()->action_init_process('create', $formDatas);
// 데이터 검증
$this->getFormService()->validate($formDatas);
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
if ($formService = $this->getFormService()) {
$formService->action_init_process('create', $formDatas);
$formService->validate($formDatas);
}
$entityClass = $this->getEntityClass();
$entity = new $entityClass($formDatas);
if (!$entity instanceof $entityClass) {
@ -193,44 +261,29 @@ abstract class CommonService
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage());
}
}
final public function create(array $formDatas): CommonEntity
{
$db = \Config\Database::connect();
try {
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
$db->transException(true)->transStart();
//관리자 정보추가용
return $this->dbTransaction(function () use ($formDatas) {
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
$entity = $this->create_process($formDatas);
$db->transComplete();
return $entity;
} catch (DatabaseException $e) {
// DatabaseException을 포착하면 자동으로 롤백 처리됨
throw new RuntimeException(sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
static::class . '->' . __FUNCTION__,
$this->model->getLastQuery(),
$e->getMessage()
), $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage());
}
return $this->create_process($formDatas);
}, __FUNCTION__);
}
//수정용
protected function modify_process($entity, array $formDatas): CommonEntity
{
try {
$this->getFormService()->action_init_process('modify', $formDatas);
// 2. 사용자 입력값(formDatas)을 Entity에 주입
// fill()을 사용하면 Entity 내부에서 어떤 값이 변경되었는지(Dirty) 추적 시작
if ($formService = $this->getFormService()) {
$formService->action_init_process('modify', $formDatas);
}
$entity->fill($formDatas);
if (!$entity->hasChanged()) {
return $entity;
}
// 데이터 검증
$this->getFormService()->validate($entity->toArray());
if ($formService = $this->getFormService()) {
$formService->validate($entity->toArray());
}
return $this->save_process($entity);
} catch (\Throwable $e) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage() . "\n" . var_export($entity));
@ -239,31 +292,14 @@ abstract class CommonService
final public function modify(string|int $uid, array $formDatas): CommonEntity
{
$db = \Config\Database::connect();
try {
$db->transException(true)->transStart();
return $this->dbTransaction(function () use ($uid, $formDatas) {
$entity = $this->getEntity($uid);
if (!$entity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
}
//관리자 정보추가용
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
$entity = $this->modify_process($entity, $formDatas);
// 트랜잭션 완료 및 커밋
$db->transComplete();
return $entity;
} catch (DatabaseException $e) {
// DatabaseException을 포착하면 자동으로 롤백 처리됨
throw new RuntimeException(sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
static::class . '->' . __FUNCTION__,
$this->model->getLastQuery(),
$e->getMessage()
), $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage());
}
return $this->modify_process($entity, $formDatas);
}, __FUNCTION__);
}
//배치 작업용 수정
@ -274,30 +310,22 @@ abstract class CommonService
}
final public function batchjob(array $uids, array $formDatas): array
{
$db = \Config\Database::connect();
try {
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
$db->transException(true)->transStart();
return $this->dbTransaction(function () use ($uids, $formDatas) {
$entities = [];
foreach ($uids as $uid) {
$entity = $this->getEntity($uid);
if (!$entity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
}
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
//관리자 정보추가용
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
$entities[] = $this->batchjob_process($entity, $formDatas);
}
return $entities;
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage());
}
}, __FUNCTION__);
}
//삭제용 (일반)
@ -314,8 +342,7 @@ abstract class CommonService
}
final public function delete(string|int $uid): CommonEntity
{
$db = \Config\Database::connect();
try {
return $this->dbTransaction(function () use ($uid) {
if (!$uid) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 삭제에 필요한 PrimaryKey 가 정의 되지 않았습니다.");
}
@ -323,28 +350,12 @@ abstract class CommonService
if (!$entity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
}
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
$db->transException(true)->transStart();
$entity = $this->delete_process($entity);
// 트랜잭션 완료 및 커밋
$db->transComplete();
return $entity;
} catch (DatabaseException $e) {
// DatabaseException을 포착하면 자동으로 롤백 처리됨
throw new RuntimeException(sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
__FUNCTION__,
$this->model->getLastQuery(),
$e->getMessage()
), $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage());
}
return $this->delete_process($entity);
}, __FUNCTION__);
}
//삭제용 (배치 작업)
@ -356,38 +367,21 @@ abstract class CommonService
final public function batchjob_delete(array $uids): array
{
$db = \Config\Database::connect();
try {
$db->transException(true)->transStart();
//일괄작업처리
return $this->dbTransaction(function () use ($uids) {
$entities = [];
foreach ($uids as $uid) {
$entity = $this->getEntity($uid);
if (!$entity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
}
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
$entities[] = $this->batchjob_delete_process($entity);
}
// 트랜잭션 완료 및 커밋
$db->transComplete();
return $entities;
} catch (DatabaseException $e) {
// DatabaseException을 포착하면 자동으로 롤백 처리됨
throw new RuntimeException(sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
__FUNCTION__,
$this->model->getLastQuery(),
$e->getMessage()
), $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage());
}
}, __FUNCTION__);
}
//Index용

View File

@ -12,8 +12,9 @@ use RuntimeException;
class ClientService extends CustomerService
{
private $_form = null;
private $_helper = null;
protected string $formClass = ClientForm::class;
protected string $helperClass = ClientHelper::class;
public function __construct(ClientModel $model)
{
parent::__construct($model);
@ -31,34 +32,6 @@ class ClientService extends CustomerService
{
return ClientEntity::class;
}
public function getFormService(): ClientForm
{
if ($this->_form === null) {
$this->_form = new ClientForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): ClientHelper
{
if ($this->_helper === null) {
$this->_helper = new ClientHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): ClientEntity
{

View File

@ -13,8 +13,9 @@ use RuntimeException;
class ServiceService extends CustomerService
{
private $_form = null;
private $_helper = null;
protected string $formClass = ServiceForm::class;
protected string $helperClass = ServiceHelper::class;
public function __construct(ServiceModel $model)
{
parent::__construct($model);
@ -32,34 +33,6 @@ class ServiceService extends CustomerService
{
return ServiceEntity::class;
}
public function getFormService(): ServiceForm
{
if ($this->_form === null) {
$this->_form = new ServiceForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): ServiceHelper
{
if ($this->_helper === null) {
$this->_helper = new ServiceHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//추가 기능
//interval을 기준으로 최근 신규 서비스정보 가져오기
final public function getNewServiceEntities(int $interval, string $status = STATUS['AVAILABLE']): array

View File

@ -14,8 +14,9 @@ use RuntimeException;
class AccountService extends WalletService
{
const CLIENTINFO_BALANCE_FIELD = 'account_balance';
private $_form = null;
private $_helper = null;
protected string $formClass = AccountForm::class;
protected string $helperClass = AccountHelper::class;
public function __construct(AccountModel $model)
{
parent::__construct($model);
@ -33,34 +34,6 @@ class AccountService extends WalletService
{
return AccountEntity::class;
}
public function getFormService(): AccountForm
{
if ($this->_form === null) {
$this->_form = new AccountForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): AccountHelper
{
if ($this->_helper === null) {
$this->_helper = new AccountHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): AccountEntity
{

View File

@ -14,8 +14,9 @@ use RuntimeException;
class CouponService extends WalletService
{
const CLIENTINFO_BALANCE_FIELD = 'coupon_balance';
private $_form = null;
private $_helper = null;
protected string $formClass = CouponForm::class;
protected string $helperClass = CouponHelper::class;
public function __construct(CouponModel $model)
{
parent::__construct($model);
@ -33,34 +34,6 @@ class CouponService extends WalletService
{
return CouponEntity::class;
}
public function getFormService(): CouponForm
{
if ($this->_form === null) {
$this->_form = new CouponForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): CouponHelper
{
if ($this->_helper === null) {
$this->_helper = new CouponHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): CouponEntity
{

View File

@ -14,8 +14,9 @@ use RuntimeException;
class PointService extends WalletService
{
const CLIENTINFO_BALANCE_FIELD = 'point_balance';
private $_form = null;
private $_helper = null;
protected string $formClass = PointForm::class;
protected string $helperClass = PointHelper::class;
public function __construct(PointModel $model)
{
parent::__construct($model);
@ -33,34 +34,6 @@ class PointService extends WalletService
{
return PointEntity::class;
}
public function getFormService(): PointForm
{
if ($this->_form === null) {
$this->_form = new PointForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): PointHelper
{
if ($this->_helper === null) {
$this->_helper = new PointHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): PointEntity
{

View File

@ -13,8 +13,9 @@ use RuntimeException;
class CHASSISService extends EquipmentService
{
private $_form = null;
private $_helper = null;
protected string $formClass = CHASSISForm::class;
protected string $helperClass = CHASSISHelper::class;
public function __construct(CHASSISModel $model)
{
parent::__construct($model);
@ -32,34 +33,6 @@ class CHASSISService extends EquipmentService
{
return CHASSISEntity::class;
}
public function getFormService(): CHASSISForm
{
if ($this->_form === null) {
$this->_form = new CHASSISForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): CHASSISHelper
{
if ($this->_helper === null) {
$this->_helper = new CHASSISHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): CHASSISEntity
{

View File

@ -13,8 +13,9 @@ use RuntimeException;
class LineService extends EquipmentService
{
use UtilTrait;
private $_form = null;
private $_helper = null;
protected string $formClass = LineForm::class;
protected string $helperClass = LineHelper::class;
public function __construct(LineModel $model)
{
parent::__construct($model);
@ -32,34 +33,6 @@ class LineService extends EquipmentService
{
return LineEntity::class;
}
public function getFormService(): LineForm
{
if ($this->_form === null) {
$this->_form = new LineForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): LineHelper
{
if ($this->_helper === null) {
$this->_helper = new LineHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): LineEntity
{

View File

@ -16,8 +16,9 @@ use RuntimeException;
class ServerPartService extends EquipmentService
{
private $_form = null;
private $_helper = null;
protected string $formClass = ServerPartForm::class;
protected string $helperClass = ServerPartHelper::class;
public function __construct(ServerPartModel $model)
{
parent::__construct($model);
@ -35,34 +36,6 @@ class ServerPartService extends EquipmentService
{
return ServerPartEntity::class;
}
public function getFormService(): ServerPartForm
{
if ($this->_form === null) {
$this->_form = new ServerPartForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): ServerPartHelper
{
if ($this->_helper === null) {
$this->_helper = new ServerPartHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//각 파트별 서비스
private function getPartService(string $type): PartService
{

View File

@ -13,8 +13,9 @@ use RuntimeException;
class ServerService extends EquipmentService
{
private $_form = null;
private $_helper = null;
protected string $formClass = ServerForm::class;
protected string $helperClass = ServerHelper::class;
public function __construct(ServerModel $model)
{
parent::__construct($model);
@ -32,34 +33,6 @@ class ServerService extends EquipmentService
{
return ServerEntity::class;
}
public function getFormService(): ServerForm
{
if ($this->_form === null) {
$this->_form = new ServerForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): ServerHelper
{
if ($this->_helper === null) {
$this->_helper = new ServerHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
final public function getTotalServiceCount(array $where = []): array
{
$totalCounts = [

View File

@ -12,8 +12,9 @@ use App\DTOs\MylogDTO;
class MylogService extends CommonService implements PipelineStepInterface
{
private $_form = null;
private $_helper = null;
protected string $formClass = MylogForm::class;
protected string $helperClass = MylogHelper::class;
public function __construct(MylogModel $model)
{
parent::__construct($model);
@ -31,34 +32,6 @@ class MylogService extends CommonService implements PipelineStepInterface
{
return MylogEntity::class;
}
public function getFormService(): MylogForm
{
if ($this->_form === null) {
$this->_form = new MylogForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): MylogHelper
{
if ($this->_helper === null) {
$this->_helper = new MylogHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
/**
* LogService는 START/SUCCESS/FAILURE 로그를 기록합니다.
* LogService는 파이프라인의 시작과 끝에서만 Executor에 의해 직접 호출됩니다.
@ -90,12 +63,4 @@ class MylogService extends CommonService implements PipelineStepInterface
{
return $entity;
}
protected function create_process(array $formDatas): MylogEntity
{
return parent::create_process($formDatas);
}
protected function modify_process($entity, array $formDatas): MylogEntity
{
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -12,8 +12,9 @@ use RuntimeException;
class CPUService extends PartType1Service
{
private $_form = null;
private $_helper = null;
protected string $formClass = CPUForm::class;
protected string $helperClass = CPUHelper::class;
public function __construct(CPUModel $model)
{
parent::__construct($model);
@ -31,34 +32,6 @@ class CPUService extends PartType1Service
{
return CPUEntity::class;
}
public function getFormService(): CPUForm
{
if ($this->_form === null) {
$this->_form = new CPUForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): CPUHelper
{
if ($this->_helper === null) {
$this->_helper = new CPUHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): CPUEntity
{

View File

@ -12,8 +12,9 @@ use App\DTOs\Part\CSDTO;
class CSService extends PartType2Service
{
private $_form = null;
private $_helper = null;
protected string $formClass = CSForm::class;
protected string $helperClass = CSHelper::class;
public function __construct(CSModel $model)
{
parent::__construct($model);
@ -31,34 +32,6 @@ class CSService extends PartType2Service
{
return CSEntity::class;
}
public function getFormService(): CSForm
{
if ($this->_form === null) {
$this->_form = new CSForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): CSHelper
{
if ($this->_helper === null) {
$this->_helper = new CSHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): CSEntity
{

View File

@ -13,8 +13,9 @@ use App\DTOs\Part\DISKDTO;
class DISKService extends PartType1Service
{
private $_form = null;
private $_helper = null;
protected string $formClass = DISKForm::class;
protected string $helperClass = DISKHelper::class;
public function __construct(DISKModel $model)
{
parent::__construct($model);
@ -32,34 +33,6 @@ class DISKService extends PartType1Service
{
return DISKEntity::class;
}
public function getFormService(): DISKForm
{
if ($this->_form === null) {
$this->_form = new DISKForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): DISKHelper
{
if ($this->_helper === null) {
$this->_helper = new DISKHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): DISKEntity
{

View File

@ -14,8 +14,9 @@ use RuntimeException;
class IPService extends PartType3Service
{
private $_form = null;
private $_helper = null;
protected string $formClass = IPForm::class;
protected string $helperClass = IPHelper::class;
public function __construct(IPModel $model)
{
parent::__construct($model);
@ -33,34 +34,6 @@ class IPService extends PartType3Service
{
return IPEntity::class;
}
public function getFormService(): IPForm
{
if ($this->_form === null) {
$this->_form = new IPForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): IPHelper
{
if ($this->_helper === null) {
$this->_helper = new IPHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): IPEntity
{

View File

@ -12,8 +12,9 @@ use App\DTOs\Part\RAMDTO;
class RAMService extends PartType1Service
{
private $_form = null;
private $_helper = null;
protected string $formClass = RAMForm::class;
protected string $helperClass = RAMHelper::class;
public function __construct(RAMModel $model)
{
parent::__construct($model);
@ -31,34 +32,6 @@ class RAMService extends PartType1Service
{
return RAMEntity::class;
}
public function getFormService(): RAMForm
{
if ($this->_form === null) {
$this->_form = new RAMForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): RAMHelper
{
if ($this->_helper === null) {
$this->_helper = new RAMHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): RAMEntity
{

View File

@ -13,8 +13,9 @@ use App\DTOs\Part\SOFTWAREDTO;
class SOFTWAREService extends PartType1Service
{
private $_form = null;
private $_helper = null;
protected string $formClass = SOFTWAREForm::class;
protected string $helperClass = SOFTWAREHelper::class;
public function __construct(SOFTWAREModel $model)
{
parent::__construct($model);
@ -32,34 +33,6 @@ class SOFTWAREService extends PartType1Service
{
return SOFTWAREEntity::class;
}
public function getFormService(): SOFTWAREForm
{
if ($this->_form === null) {
$this->_form = new SOFTWAREForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): SOFTWAREHelper
{
if ($this->_helper === null) {
$this->_helper = new SOFTWAREHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): SOFTWAREEntity
{

View File

@ -14,8 +14,9 @@ use App\DTOs\Part\SWITCHDTO;
class SWITCHService extends PartType3Service
{
private $_form = null;
private $_helper = null;
protected string $formClass = SWITCHForm::class;
protected string $helperClass = SWITCHHelper::class;
public function __construct(SWITCHModel $model)
{
parent::__construct($model);
@ -33,34 +34,6 @@ class SWITCHService extends PartType3Service
{
return SWITCHEntity::class;
}
public function getFormService(): SWITCHForm
{
if ($this->_form === null) {
$this->_form = new SWITCHForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): SWITCHHelper
{
if ($this->_helper === null) {
$this->_helper = new SWITCHHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): SWITCHEntity
{

View File

@ -18,8 +18,9 @@ use RuntimeException;
class PaymentService extends CommonService
{
private $_form = null;
private $_helper = null;
protected string $formClass = PaymentForm::class;
protected string $helperClass = PaymentHelper::class;
public function __construct(PaymentModel $model)
{
parent::__construct($model);
@ -37,34 +38,6 @@ class PaymentService extends CommonService
{
return new PaymentDTO($formDatas);
}
public function getFormService(): PaymentForm
{
if ($this->_form === null) {
$this->_form = new PaymentForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): PaymentHelper
{
if ($this->_helper === null) {
$this->_helper = new PaymentHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//총 미납건수, 금액
final public function getUnPaids(string $group, array $where = []): array
{
@ -146,7 +119,8 @@ class PaymentService extends CommonService
}
//지불이 완료된경우 지불처리
if ($entity->getStatus() === STATUS['PAID']) {
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);;
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
;
}
//선결제인경우 서비스정보에 결제일 변경용
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
@ -171,7 +145,8 @@ class PaymentService extends CommonService
}
//지불이 된경우 지불처리
if ($entity->getStatus() === STATUS['PAID']) {
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);;
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
;
}
//선결제인경우 서비스정보에 결제일 변경용
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {

View File

@ -12,8 +12,9 @@ use App\DTOs\UserDTO;
class UserService extends CommonService
{
private $_form = null;
private $_helper = null;
protected string $formClass = UserForm::class;
protected string $helperClass = UserHelper::class;
public function __construct(UserModel $model)
{
parent::__construct($model);
@ -31,34 +32,6 @@ class UserService extends CommonService
{
return UserEntity::class;
}
public function getFormService(): UserForm
{
if ($this->_form === null) {
$this->_form = new UserForm();
$this->_form->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): UserHelper
{
if ($this->_helper === null) {
$this->_helper = new UserHelper();
$this->_helper->setAttributes([
'pk_field' => $this->getPKField(),
'title_field' => $this->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): UserEntity
{