cfmgrv4 init...3

This commit is contained in:
최준흠 2024-10-25 10:31:22 +09:00
parent cb5810855e
commit ed55aad2fd
13 changed files with 133 additions and 147 deletions

View File

@ -64,6 +64,11 @@ class AuthController extends CloudflareController
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'authkey', 'status']); $this->init(__FUNCTION__, [$this->getModel()::TITLE, 'authkey', 'status']);
return $this->modify_procedure($uid); return $this->modify_procedure($uid);
} }
//단일필드작업
public function toggle(mixed $uid, string $field): RedirectResponse
{
return $this->toggle_procedure($uid, $field);
}
//일괄처리작업 //일괄처리작업
public function batcjob(): RedirectResponse public function batcjob(): RedirectResponse
{ {

View File

@ -64,8 +64,7 @@ class FirewallController extends CloudflareController
protected function modify_process(mixed $uid): void protected function modify_process(mixed $uid): void
{ {
//DB작업도 Socket에서 다 처리하므로 parent::modify_process($uid)하면 않됨 //DB작업도 Socket에서 다 처리하므로 parent::modify_process($uid)하면 않됨
$this->modify_validate($this->action, $this->fields); $this->formDatas = $this->modify_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
//자신정보정의 //자신정보정의
$this->entity = $this->getModel()->getEntityByPK($uid); $this->entity = $this->getModel()->getEntityByPK($uid);
if ($this->entity === null) { if ($this->entity === null) {

View File

@ -50,22 +50,6 @@ class RecordController extends CloudflareController
} }
return $options; return $options;
} }
//전송된 데이터
protected function getFormData(string $field, array $formDatas): array
{
switch ($field) {
case 'hosts':
$formDatas[$field] = explode("\n", $this->request->getVar($field));
if (!is_array($formDatas[$field]) || !count($formDatas[$field])) {
throw new \Exception("호스트명이 정의되지 않았습니다.");
}
break;
default:
$formDatas = parent::getFormData($field, $formDatas);
break;
}
return $formDatas;
}
private function init(string $action, array $fields = []): void private function init(string $action, array $fields = []): void
{ {
$this->action = $action; $this->action = $action;
@ -85,10 +69,10 @@ class RecordController extends CloudflareController
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"]; $this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
return $this->create_form_procedure(); return $this->create_form_procedure();
} }
protected function create_validate(string $action, array $fields): void protected function create_validate(string $action, array $fields): array
{ {
//hosts를 제외한 fields Valid처리 //hosts를 제외한 fields Valid처리
parent::create_validate($action, array_diff($fields, ['hosts'])); return parent::create_validate($action, array_diff($fields, ['hosts']));
} }
private function setEntitys(array $entitys): void private function setEntitys(array $entitys): void
{ {
@ -97,28 +81,30 @@ class RecordController extends CloudflareController
protected function create_process(): void protected function create_process(): void
{ {
//DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨 //DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨
$this->create_validate($this->action, $this->fields); $this->formDatas = $this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
//부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
//데이터 검증
$cnt = 1;
foreach ($this->formDatas['hosts'] as $host) {
//호스트명 형식확인
if (!$this->helper->isHost($host)) {
throw new \Exception("{$host} 호스트명 형식 오류");
}
$cnt++;
}
//Type이 A형식일경우 IP형태인지 확인 //Type이 A형식일경우 IP형태인지 확인
if ($this->formDatas['type'] === 'A') { if ($this->formDatas['type'] === 'A') {
if (!$this->helper->isIPAddress($this->formDatas['content'], $this->formDatas['type'])) { if (!$this->helper->isIPAddress($this->formDatas['content'], $this->formDatas['type'])) {
throw new \Exception("{$this->formDatas['type']}, {$this->formDatas['content']} 형식 오류[사설IP 않됨]"); throw new \Exception("{$this->formDatas['type']}, {$this->formDatas['content']} 형식 오류[사설IP 않됨]");
} }
} }
//호스트명 형식확인
$hosts = explode("\n", $this->formDatas['hosts']);
if (!is_array($hosts) || !count($hosts)) {
throw new \Exception("호스트명이 정의되지 않았습니다.");
}
$cnt = 1;
foreach ($hosts as $host) {
if (!$this->helper->isHost($host)) {
throw new \Exception("입력하신 {$cnt}번째 : [{$host}]는 호스트명 입력형식에 맞지 않습니다.");
}
$cnt++;
}
//Socket처리 //Socket처리
//부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
$entitys = []; $entitys = [];
foreach ($this->formDatas['hosts'] as $host) { foreach ($hosts as $host) {
$entity = $this->getService()->create( $entity = $this->getService()->create(
$this->_zone_entity, $this->_zone_entity,
$host, $host,
@ -151,8 +137,7 @@ class RecordController extends CloudflareController
protected function modify_process(mixed $uid): void protected function modify_process(mixed $uid): void
{ {
//DB작업도 Socket에서 다 처리하므로 parent::modify_process($uid)하면 않됨 //DB작업도 Socket에서 다 처리하므로 parent::modify_process($uid)하면 않됨
$this->modify_validate($this->action, $this->fields); $this->formDatas = $this->modify_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
//자신정보정의 //자신정보정의
$this->entity = $this->getModel()->getEntityByPK($uid); $this->entity = $this->getModel()->getEntityByPK($uid);
if ($this->entity === null) { if ($this->entity === null) {
@ -160,7 +145,6 @@ class RecordController extends CloudflareController
} }
//fixed 필드가 있고 값이 변경되었을때(toggle에서 fixed만 설정시사용) //fixed 필드가 있고 값이 변경되었을때(toggle에서 fixed만 설정시사용)
if (in_array('fixed', $this->fields)) { if (in_array('fixed', $this->fields)) {
// dd($this->formDatas, $this->entity->fixed);
if (isset($this->formDatas['fixed']) && $this->formDatas['fixed'] !== $this->entity->fixed) { if (isset($this->formDatas['fixed']) && $this->formDatas['fixed'] !== $this->entity->fixed) {
$this->entity = $this->getModel()->modify($this->entity, $this->formDatas); $this->entity = $this->getModel()->modify($this->entity, $this->formDatas);
} }
@ -171,6 +155,11 @@ class RecordController extends CloudflareController
$this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas); $this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas);
} }
} }
//단일필드작업
public function toggle(mixed $uid, string $field): RedirectResponse
{
return $this->toggle_procedure($uid, $field);
}
//일괄처리작업 //일괄처리작업
public function batcjob(): RedirectResponse public function batcjob(): RedirectResponse
{ {

View File

@ -55,27 +55,6 @@ class ZoneController extends CloudflareController
} }
return $options; return $options;
} }
protected function getFormData(string $field, array $formDatas): array
{
switch ($field) {
case 'domains':
$formDatas[$field] = explode("\n", $this->request->getVar($field));
if (!is_array($formDatas[$field]) || !count($formDatas[$field])) {
throw new \Exception("도메인명이 정의되지 않았습니다.");
}
break;
case 'hosts':
$formDatas[$field] = explode("\n", $this->request->getVar($field));
if (!is_array($formDatas[$field]) || !count($formDatas[$field])) {
throw new \Exception("호스트명이 정의되지 않았습니다");
}
break;
default:
$formDatas = parent::getFormData($field, $formDatas);
break;
}
return $formDatas;
}
private function init(string $action, array $fields = []): void private function init(string $action, array $fields = []): void
{ {
$this->action = $action; $this->action = $action;
@ -97,10 +76,10 @@ class ZoneController extends CloudflareController
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"]; $this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
return $this->create_form_procedure(); return $this->create_form_procedure();
} }
protected function create_validate(string $action, array $fields): void protected function create_validate(string $action, array $fields): array
{ {
//domains,hosts를 제외한 fields Valid처리 //domains,hosts를 제외한 fields Valid처리
parent::create_validate($action, array_diff($fields, ['domains', 'hosts'])); return parent::create_validate($action, array_diff($fields, ['domains', 'hosts']));
} }
private function setEntitys(array $entitys): void private function setEntitys(array $entitys): void
{ {
@ -109,10 +88,7 @@ class ZoneController extends CloudflareController
protected function create_process(): void protected function create_process(): void
{ {
//DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨 //DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨
$this->create_validate($this->action, $this->fields); $this->formDatas = $this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
//부모데이터 정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
//데이터검증 //데이터검증
//Type이 A형식일경우 IP형태인지 확인 //Type이 A형식일경우 IP형태인지 확인
if ($this->formDatas['type'] === 'A') { if ($this->formDatas['type'] === 'A') {
@ -120,27 +96,38 @@ class ZoneController extends CloudflareController
throw new \Exception("{$this->formDatas['type']}, {$this->formDatas['content']} 형식 오류[사설IP 않됨]"); throw new \Exception("{$this->formDatas['type']}, {$this->formDatas['content']} 형식 오류[사설IP 않됨]");
} }
} }
//도메인명 형식확인
$domains = explode("\n", $this->formDatas['domains']);
if (!is_array($domains) || !count($domains)) {
throw new \Exception("도메인명이 정의되지 않았습니다.");
}
$cnt = 1; $cnt = 1;
foreach ($this->formDatas['domains'] as $domain) { foreach ($domains as $domain) {
//도메인명 형식확인 //도메인명 형식확인
if (!$this->helper->isDomain($domain)) { if (!$this->helper->isDomain($domain)) {
throw new \Exception("{$domain} 형식 오류"); throw new \Exception("{$cnt}번째 : [{$domain}]는 도메인명 형식에 맞지 않습니다.");
} }
//도메인명이 해당계정의 유일한 도메인인지 확인 //도메인명이 해당계정의 유일한 도메인인지 확인
if (!$this->getModel()->isUniqueDomain($this->_account_entity, $domain)) { if (!$this->getModel()->isUniqueDomain($this->_account_entity, $domain)) {
throw new \Exception("{$domain} 이미 등록된 도메인입니다."); throw new \Exception("{$cnt}번째 : [{$domain}]는 이미 등록된 도메인입니다.");
} }
$cnt++; $cnt++;
} }
//호스트명 형식확인
$hosts = explode("\n", $this->formDatas['hosts']);
if (!is_array($hosts) || !count($hosts)) {
throw new \Exception("호스트명이 정의되지 않았습니다.");
}
$cnt = 1; $cnt = 1;
foreach ($this->formDatas['hosts'] as $host) { foreach ($hosts as $host) {
//호스트명 형식확인
if (!$this->helper->isHost($host)) { if (!$this->helper->isHost($host)) {
throw new \Exception("{$host} 호스트명 형식 오류"); throw new \Exception("{$cnt}번째 : [{$host}]는 호스트명 형식에 맞지 않습니다.");
} }
$cnt++; $cnt++;
} }
//Socket처리 //Socket처리
//부모데이터 정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
//Zone생성 //Zone생성
$cnt = 1; $cnt = 1;
$zone_entitys = []; $zone_entitys = [];
@ -193,8 +180,7 @@ class ZoneController extends CloudflareController
protected function modify_process(mixed $uid): void protected function modify_process(mixed $uid): void
{ {
//DB작업도 Socket에서 다 처리하므로 parent::modify_process($uid)하면 않됨 //DB작업도 Socket에서 다 처리하므로 parent::modify_process($uid)하면 않됨
$this->modify_validate($this->action, $this->fields); $this->formDatas = $this->modify_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
//자신정보정의 //자신정보정의
$this->entity = $this->getModel()->getEntityByPK($uid); $this->entity = $this->getModel()->getEntityByPK($uid);
if ($this->entity === null) { if ($this->entity === null) {
@ -205,6 +191,10 @@ class ZoneController extends CloudflareController
//Socket처리 //Socket처리
$this->entity = $this->getService()->modify($this->_account_entity, $this->entity, $this->formDatas); $this->entity = $this->getService()->modify($this->_account_entity, $this->entity, $this->formDatas);
} }
public function toggle(mixed $uid, string $field): RedirectResponse
{
return $this->toggle_procedure($uid, $field);
}
//일괄처리작업 //일괄처리작업
public function batcjob(): RedirectResponse public function batcjob(): RedirectResponse
{ {

View File

@ -93,6 +93,10 @@ class MapurlController extends AdminController
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'newurl', 'status']); $this->init(__FUNCTION__, [$this->getModel()::TITLE, 'newurl', 'status']);
return $this->modify_procedure($uid); return $this->modify_procedure($uid);
} }
public function toggle(mixed $uid, string $field): RedirectResponse
{
return $this->toggle_procedure($uid, $field);
}
//일괄처리작업 //일괄처리작업
public function batcjob(): RedirectResponse public function batcjob(): RedirectResponse
{ {

View File

@ -48,34 +48,6 @@ class UserController extends AdminController
} }
return $validation; return $validation;
} }
protected function getFormData(string $field, array $formDatas): array
{
switch ($field) {
case 'role':
$roles = $this->request->getVar($field) ?? [];
if (!count($roles)) {
throw new \Exception("권한이 지정되지 않았습니다.");
}
$formDatas[$field] = implode(DEFAULTS["DELIMITER_ROLE"], $roles);
break;
case 'passwd': //데이터가 있을때면 formData에 넣어줌 : 수정시에는 않넣을수도 있어야하므로
$passwd = $this->request->getVar($field);
if ($passwd) {
$formDatas[$field] = $passwd;
}
break;
case 'confirmpassword':
$confirmpassword = $this->request->getVar($field);
if ($confirmpassword) {
$formDatas[$field] = $confirmpassword;
}
break;
default:
$formDatas = parent::getFormData($field, $formDatas);
break;
}
return $formDatas;
}
private function init(string $action, array $fields = []): void private function init(string $action, array $fields = []): void
{ {
$this->action = $action; $this->action = $action;
@ -107,6 +79,10 @@ class UserController extends AdminController
$this->init(__FUNCTION__, ['passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role']); $this->init(__FUNCTION__, ['passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role']);
return $this->modify_procedure($uid); return $this->modify_procedure($uid);
} }
public function toggle(mixed $uid, string $field): RedirectResponse
{
return $this->toggle_procedure($uid, $field);
}
//일괄작업 //일괄작업
public function batcjob(): RedirectResponse public function batcjob(): RedirectResponse
{ {

View File

@ -70,6 +70,10 @@ class UserSNSController extends AdminController
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email']); $this->init(__FUNCTION__, [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email']);
return $this->modify_procedure($uid); return $this->modify_procedure($uid);
} }
public function toggle(mixed $uid, string $field): RedirectResponse
{
return $this->toggle_procedure($uid, $field);
}
//일괄작업 //일괄작업
public function batcjob(): RedirectResponse public function batcjob(): RedirectResponse
{ {

View File

@ -64,8 +64,7 @@ class AuthController extends MVController
{ {
try { try {
$this->init('login'); $this->init('login');
$this->create_validate($this->action, $this->fields); $this->formDatas = $this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
$auth = new LocalAuth(); $auth = new LocalAuth();
$auth->login($auth->checkUser($this->formDatas)); $auth->login($auth->checkUser($this->formDatas));
$this->message = "로그인 성공"; $this->message = "로그인 성공";

View File

@ -60,23 +60,6 @@ abstract class MVController extends CommonController
} }
return $options; return $options;
} }
//전송된 데이터
protected function getFormData(string $field, array $formDatas): array
{
switch ($field) {
default:
$formDatas[$field] = $this->request->getVar($field);
break;
}
return $formDatas;
}
final protected function getFormDatas(array $formDatas = []): array
{
foreach ($this->fields as $field) {
$formDatas = $this->getFormData($field, $formDatas);
}
return $formDatas;
}
// 생성 // 생성
protected function create_form_process(): void {} protected function create_form_process(): void {}
final protected function create_form_procedure(): RedirectResponse|string final protected function create_form_procedure(): RedirectResponse|string
@ -94,7 +77,7 @@ abstract class MVController extends CommonController
return redirect()->back()->with('error', $e->getMessage()); return redirect()->back()->with('error', $e->getMessage());
} }
} }
protected function create_validate(string $action, array $fields): void protected function create_validate(string $action, array $fields): array
{ {
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요 //변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
$validation = $this->getValidation($fields, service('validation'), $action); $validation = $this->getValidation($fields, service('validation'), $action);
@ -104,11 +87,11 @@ abstract class MVController extends CommonController
$validation->getErrors() $validation->getErrors()
)); ));
} }
return $validation->getValidated();
} }
protected function create_process(): void protected function create_process(): void
{ {
$this->create_validate($this->action, $this->fields); $this->formDatas = $this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
$this->entity = $this->getService()->create($this->formDatas); $this->entity = $this->getService()->create($this->formDatas);
} }
protected function create_process_result(): RedirectResponse|string protected function create_process_result(): RedirectResponse|string
@ -157,7 +140,7 @@ abstract class MVController extends CommonController
return redirect()->back()->with('error', $e->getMessage()); return redirect()->back()->with('error', $e->getMessage());
} }
} }
final protected function modify_validate(string $action, array $fields): void final protected function modify_validate(string $action, array $fields): array
{ {
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요 //변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
$validation = $this->getValidation($fields, service('validation'), $action); $validation = $this->getValidation($fields, service('validation'), $action);
@ -167,11 +150,11 @@ abstract class MVController extends CommonController
$validation->getErrors() $validation->getErrors()
)); ));
} }
return $validation->getValidated();
} }
protected function modify_process(mixed $uid): void protected function modify_process(mixed $uid): void
{ {
$this->modify_validate($this->action, $this->fields); $this->formDatas = $this->modify_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
//자신정보정의 //자신정보정의
$this->entity = $this->getModel()->getEntityByPK($uid); $this->entity = $this->getModel()->getEntityByPK($uid);
if ($this->entity === null) { if ($this->entity === null) {
@ -202,6 +185,27 @@ abstract class MVController extends CommonController
return redirect()->back()->withInput()->with('error', __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage()); return redirect()->back()->withInput()->with('error', __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
} }
} }
//단일필드작업
final protected function toggle_procedure(mixed $uid, string $field): RedirectResponse
{
//Transaction Start
$this->getModel()->transStart();
try {
$this->action = __FUNCTION__;
$this->fields = [$field];
$this->modify_process($uid);
$this->getModel()->transCommit();
$this->message = "{$this->getService()->class_name} : 단일필드작업이 완료되었습니다.";
log_message("notice", $this->message);
// 이전 URL로 리다이렉트
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $this->message);
} catch (\Exception $e) {
//Transaction Rollback
$this->getModel()->transRollback();
log_message("error", $e->getMessage());
return redirect()->back()->with('error', __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
}
}
//일괄처리작업 //일괄처리작업
final protected function batcjob_procedure(): RedirectResponse final protected function batcjob_procedure(): RedirectResponse
{ {
@ -236,27 +240,6 @@ abstract class MVController extends CommonController
return redirect()->back()->with('error', __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage()); return redirect()->back()->with('error', __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
} }
} }
//단일필드작업
final public function toggle(mixed $uid, string $field): RedirectResponse
{
//Transaction Start
$this->getModel()->transStart();
try {
$this->action = __FUNCTION__;
$this->fields = [$field];
$this->modify_process($uid);
$this->getModel()->transCommit();
$this->message = "{$this->getService()->class_name} : 단일필드작업이 완료되었습니다.";
log_message("notice", $this->message);
// 이전 URL로 리다이렉트
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $this->message);
} catch (\Exception $e) {
//Transaction Rollback
$this->getModel()->transRollback();
log_message("error", $e->getMessage());
return redirect()->back()->with('error', __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
}
}
//View //View
protected function view_process(mixed $uid): void protected function view_process(mixed $uid): void
{ {

View File

@ -114,4 +114,35 @@ class AccountService extends CloudflareService
log_message("notice", message: "\n-----------Auth {$this->getParentEntity()->getTitle()}의 Account 처리[" . count($entitys) . "개] 완료-----------"); log_message("notice", message: "\n-----------Auth {$this->getParentEntity()->getTitle()}의 Account 처리[" . count($entitys) . "개] 완료-----------");
return $entitys; return $entitys;
} }
public function audit(AuthEntity $parent_entity, AccountEntity $entity): array
{
//부모데이터정의
$this->setParentEntity($parent_entity);
log_message("notice", "\n----------Auth {$this->getParentEntity()->getTitle()}의 Account 처리 시작-----------");
$entitys = [];
try {
$results = $this->reload_procedure("accounts/{$entity->getPK()}/audit_logs?since=" . date("Y-m-d") . "T00:00:00");
foreach ($results as $result) {
if (isset($result->action->result) && $result->action->result && isset($result->metadata->newValueJson->zone_id)) {
//해당 Zone을 Sync작업한다
$zone_service = new ZoneService();
$zone_entity = $zone_service->getEntityByPK($result->metadata->newValueJson->zone_id);
$zone_entity = $zone_service->sync($entity, $zone_entity);
//해당 Zone의 Record reload작업한다
$record_service = new RecordService();
$record_service->reload($zone_entity);
//해당 Zone의 Firewall reload작업한다
$firewall_service = new FirewallService();
$firewall_service->reload($zone_entity);
log_message("debug", "{$entity->getTitle()} Account 의 {$zone_entity->getTitle()} Sync및 Record,Firewall Reload 처리작업");
}
}
} catch (\Exception $e) {
log_message("error", $e->getMessage());
throw new \Exception($e->getMessage());
}
log_message("notice", message: "\n-----------Auth {$this->getParentEntity()->getTitle()}의 Account 처리[" . count($entitys) . "개] 완료-----------");
return $entitys;
}
} }

View File

@ -46,6 +46,11 @@ class ZoneService extends CloudflareService
} }
return $this->_model; return $this->_model;
} }
public function getEntityByPK(string $uid): ZoneEntity
{
return $this->getModel()->getEntityByPK($uid);
}
protected function getArrayByResult(\stdClass $result, array $formDatas = []): array protected function getArrayByResult(\stdClass $result, array $formDatas = []): array
{ {
// log_message("debug", var_export($result, true)); // log_message("debug", var_export($result, true));

View File

@ -7,7 +7,6 @@ use App\Entities\MapurlEntity;
class MapurlService extends CommonService class MapurlService extends CommonService
{ {
private $_view_path = "";
private ?MapurlModel $_model = null; private ?MapurlModel $_model = null;
public function __construct() public function __construct()
{ {

View File

@ -23,10 +23,12 @@ class UserService extends CommonService
} }
public function create(array $formDatas): UserEntity public function create(array $formDatas): UserEntity
{ {
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
return $this->getModel()->create($formDatas); return $this->getModel()->create($formDatas);
} }
public function modify(UserEntity $entity, array $formDatas): UserEntity public function modify(UserEntity $entity, array $formDatas): UserEntity
{ {
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
return $this->getModel()->modify($entity, $formDatas); return $this->getModel()->modify($entity, $formDatas);
} }
public function delete(): void public function delete(): void