"", "content" => ""]; public function __construct(BoardsEntity $boards_entity, UserEntity $user_entity) { $this->_boards_entity = $boards_entity; $this->_user_entity = $user_entity; } public function getModel(): BoardModel { if ($this->_model === null) { $table_name = "mb_" . $this->_boards_entity->getTitle(); $this->_model = new BoardModel($table_name); } return $this->_model; } public function getEntity(): BoardEntity { return $this->_entity; } public function getBoardsEntity(): BoardsEntity { return $this->_boards_entity; } public function getUserEntity(): UserEntity { return $this->_user_entity; } public function setImagePath(string $image_path): void { $this->_mediaTags['image_path'] = $image_path; } public function addContent(string $content) { if ($content != "") { $this->_mediaTags['content'] .= $content; } } public function create(array $listInfo): BoardEntity { //초기화 $this->_mediaTags = ["image_path" => "", "content" => ""]; $formDatas = []; //미디어관련정보 entity에 넣기 $formDatas['title'] = $listInfo["title"]; $formDatas['user_pid'] = $this->getUserEntity()->getPK(); $formDatas['user_id'] = $this->getUserEntity()->getID(); $formDatas['user_name'] = $listInfo["nickname"] != "" ? $listInfo["nickname"] : $this->getUserEntity()->getTitle(); $formDatas['level'] = $this->getBoardsEntity()->getListLevel(); $formDatas['hit'] = $listInfo['hit']; $formDatas['reg_date'] = date("Y-m-d H:i:s", strtotime($listInfo['date'])); $formDatas['data_type'] = "html"; $formDatas['editor_type'] = "S"; $formDatas['image_path'] = ""; $formDatas['content'] = ""; //망보드 게시판에 등록 $this->_entity = $this->getModel()->create($formDatas); log_message("notice", message: __FUNCTION__ . "=>{$this->_entity->getPK()}:{$this->_entity->getTitle()} 생성 작업 완료"); return $this->_entity; } public function modify(): void { if ($this->_mediaTags['content'] != "") { $this->getModel()->modify($this->_entity, $this->_mediaTags); log_message("notice", __FUNCTION__ . "=>{$this->_entity->getPK()}:{$this->_entity->getTitle()} 수정 작업 완료"); } else { $this->getModel()->delete([$this->getModel()->getPKField() => $this->_entity->getPK()]); log_message("warning", __FUNCTION__ . "=>{$this->_entity->getPK()}:{$this->_entity->getTitle()} 내용이 없어 삭제처리"); } } }