diff --git a/app/Controllers/CLI/Yamap.php b/app/Controllers/CLI/Yamap.php index fe4a7bd..f0f3257 100644 --- a/app/Controllers/CLI/Yamap.php +++ b/app/Controllers/CLI/Yamap.php @@ -2,19 +2,18 @@ namespace App\Controllers\CLI; -use App\Controllers\BaseController; - -use App\Entities\Mangboard\FreeboardEntity; -use App\Libraries\Mangboard\FreeboardLibrary; - -use App\Libraries\MyCrawlerLibrary; -use App\Libraries\MyStorage\MyStorageFileLibrary; -use App\Libraries\MyWebLibrary; use App\Libraries\YamapLibrary; +use App\Libraries\MyWebLibrary; +use App\Libraries\MyStorage\MyStorageFileLibrary; +use App\Libraries\MyCrawlerLibrary; +use App\Libraries\Mangboard\GalleryBoardLibrary; +use App\Entities\Mangboard\BoardEntity; +use App\Controllers\BaseController; + class Yamap extends BaseController { - public function crawler(...$params): bool + public function yamap(...$params): bool { try { $isDebug = in_array("debug", $params); @@ -46,11 +45,11 @@ class Yamap extends BaseController // } //3. 망보드 일반게시판에 게시물 등록 처리 if (!in_array("skip_create", $params)) { - $board = new FreeboardLibrary(); + $board = new GalleryBoardLibrary(); $board->setDebug($isDebug); //미디어관련정보 entity에 넣기 - $entity = new FreeboardEntity(); + $entity = new BoardEntity(); $entity->setTitle($nickname); $entity->setText($nickname); $entity->setContent(is_array($mediaTags) ? implode("\n", $mediaTags) : $mediaTags); diff --git a/app/Entities/Mangboard/FreeboardEntity.php b/app/Entities/Mangboard/BoardEntity.php similarity index 95% rename from app/Entities/Mangboard/FreeboardEntity.php rename to app/Entities/Mangboard/BoardEntity.php index 1665381..184e6f2 100644 --- a/app/Entities/Mangboard/FreeboardEntity.php +++ b/app/Entities/Mangboard/BoardEntity.php @@ -4,7 +4,7 @@ namespace App\Entities\Mangboard; use App\Entities\CommonEntity; -class FreeboardEntity extends CommonEntity +class BoardEntity extends CommonEntity { public function __toString(): string { diff --git a/app/Libraries/Mangboard/BoardLibrary.php b/app/Libraries/Mangboard/BoardLibrary.php new file mode 100644 index 0000000..071c132 --- /dev/null +++ b/app/Libraries/Mangboard/BoardLibrary.php @@ -0,0 +1,27 @@ +_model = $model; + } + protected function getModel(): mixed + { + return $this->_model; + } + + public function create(BoardEntity $entity, array $formDatas = []): BoardEntity + { + $entity = $this->getModel()->create($entity, $formDatas); + log_message("debug", __FUNCTION__ . "=>등록이 완료되었습니다."); + return $entity; + } +} diff --git a/app/Libraries/Mangboard/FreeboardLibrary.php b/app/Libraries/Mangboard/FreeboardLibrary.php deleted file mode 100644 index c454e32..0000000 --- a/app/Libraries/Mangboard/FreeboardLibrary.php +++ /dev/null @@ -1,30 +0,0 @@ -_model === null) { - $this->_model = new FreeboardModel(); - } - return $this->_model; - } - - public function create(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity - { - $entity = $this->getModel()->create($entity, $formDatas); - log_message("debug", __FUNCTION__ . "=>등록이 완료되었습니다."); - return $entity; - } -} diff --git a/app/Libraries/Mangboard/GalleryBoardLibrary.php b/app/Libraries/Mangboard/GalleryBoardLibrary.php new file mode 100644 index 0000000..267af08 --- /dev/null +++ b/app/Libraries/Mangboard/GalleryBoardLibrary.php @@ -0,0 +1,17 @@ +where($this->getPKField(), $uid); return $this->getEntity(); } - public function getEntityByID(string $id): null|FreeboardEntity + public function getEntityByID(string $id): null | BoardEntity { $this->where('user_id', $id); return $this->getEntity(); } //create용 - public function create(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity + public function create(BoardEntity $entity, array $formDatas = []): BoardEntity { $entity = $this->create_process($entity, $formDatas); //GID값이 PK랑 같은 값 전달 후 Entity 수정 @@ -60,7 +59,7 @@ class FreeboardModel extends CommonModel } //modify용 - public function modify(FreeboardEntity $entity, array $formDatas = []): FreeboardEntity + public function modify(BoardEntity $entity, array $formDatas = []): BoardEntity { return $this->modify_process($entity, $formDatas); } diff --git a/app/Models/Mangboard/GalleryBoardModel.php b/app/Models/Mangboard/GalleryBoardModel.php new file mode 100644 index 0000000..a32bf45 --- /dev/null +++ b/app/Models/Mangboard/GalleryBoardModel.php @@ -0,0 +1,15 @@ +