From 0a2356080e797fd2b8a35c258bc972d0b9f92d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 25 Jul 2023 11:13:21 +0900 Subject: [PATCH] servermgrv2 init... --- app/Controllers/BaseController.php | 10 +++++----- app/Models/BaseModel.php | 1 - app/Models/BoardConfigModel.php | 2 +- app/Models/BoardModel.php | 2 +- app/Models/HPILOModel.php | 7 ++++++- app/Models/UserModel.php | 2 +- app/Models/UserSNSModel.php | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 7365afd..4fd2f0b 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -233,7 +233,7 @@ abstract class BaseController extends Controller final public function update_form($uid) { try { - $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->_viewDatas['fields'] = $this->_model->getFields('update'); $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'update'); $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); @@ -268,7 +268,7 @@ abstract class BaseController extends Controller { $message = ""; try { - $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->_viewDatas['fields'] = $this->_model->getFields('update'); $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'update'); $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); @@ -300,7 +300,7 @@ abstract class BaseController extends Controller { $message = ""; try { - $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->_viewDatas['fields'] = [$field]; $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'toggle'); $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); @@ -350,7 +350,7 @@ abstract class BaseController extends Controller $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); $entitys = array(); foreach ($uids as $uid) { - $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); try { $entity = $this->batchjob_validate($entity); array_push($entitys, $this->batchjob_process($entity)); @@ -384,7 +384,7 @@ abstract class BaseController extends Controller { $message = ""; try { - $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->delete_process($entity); $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다."; log_message("info", "{$this->_viewDatas['title']} {$message}"); diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 77e1d40..52d032f 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -3,7 +3,6 @@ namespace App\Models; use CodeIgniter\Model; -use App\Libraries\Log\Log; use App\Entities\BaseEntity; abstract class BaseModel extends Model diff --git a/app/Models/BoardConfigModel.php b/app/Models/BoardConfigModel.php index cbc41fa..6c45563 100644 --- a/app/Models/BoardConfigModel.php +++ b/app/Models/BoardConfigModel.php @@ -73,7 +73,7 @@ class BoardConfigModel extends BaseModel public function getEntity($conditions): BoardConfigEntity { $entity = $this->asObject(BoardConfigEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("{$conditions}의 해당 데이터가 없습니다.\n "); + return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); } public function getEntitys($conditions): array { diff --git a/app/Models/BoardModel.php b/app/Models/BoardModel.php index 4447742..19656d8 100644 --- a/app/Models/BoardModel.php +++ b/app/Models/BoardModel.php @@ -59,7 +59,7 @@ class BoardModel extends BaseHierarchyModel public function getEntity($conditions): BoardEntity { $entity = $this->asObject(BoardEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("{$conditions}의 해당 데이터가 없습니다.\n "); + return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); } public function getEntitys($conditions): array { diff --git a/app/Models/HPILOModel.php b/app/Models/HPILOModel.php index 64c803b..e8803d9 100644 --- a/app/Models/HPILOModel.php +++ b/app/Models/HPILOModel.php @@ -70,7 +70,7 @@ class HPILOModel extends BaseModel public function getEntity($conditions): HPILOEntity { $entity = $this->asObject(HPILOEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("{$conditions}의 해당 정보가 없습니다.\n "); + return $entity ?: throw new \Exception("해당 정보가 없습니다.\n " . var_export($conditions, true)); } public function getEntitys($conditions): array { @@ -80,6 +80,11 @@ class HPILOModel extends BaseModel protected function changeFormData(string $field, array $formDatas, $entity) { switch ($field) { + case "passwd": //API에서 사용하므로 암호를 바꾸면 않됨 + if (array_key_exists($field, $formDatas) && $formDatas[$field]) { + $entity->$field = $formDatas[$field]; + } + break; default: return parent::changeFormData($field, $formDatas, $entity); break; diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index c486c4d..8d5bde4 100644 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -67,7 +67,7 @@ class UserModel extends BaseModel public function getEntity($conditions): UserEntity { $entity = $this->asObject(UserEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("{$conditions}의 해당 사용자가 없습니다.\n "); + return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); } public function getEntitys($conditions): array { diff --git a/app/Models/UserSNSModel.php b/app/Models/UserSNSModel.php index 5eee0f8..48e91a4 100644 --- a/app/Models/UserSNSModel.php +++ b/app/Models/UserSNSModel.php @@ -61,7 +61,7 @@ class UserSNSModel extends BaseModel public function getEntity($conditions): UserSNSEntity { $entity = $this->asObject(UserSNSEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("{$conditions}의 해당 데이터가 없습니다.\n "); + return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); } public function getEntitys($conditions): array {