_model === null) { return $this->_model = new FileModel(); } return $this->_model; } //override public function getEntity(): FileEntity { if ($this->_entity === null) { $this->_entity = new FileEntity(); $this->_entity->setPath($this->getPath()); } return $this->_entity; } public function getUser(): UserEntity { if ($this->_user === null) { throw new \Exception("사용자정보가 없습니다."); } return $this->_user; } public function setUser(UserEntity $user): void { $this->_user = $user; } public function getBoardName(): string { if ($this->_boardName === null) { throw new \Exception("BoardModel이 지정되지 않았습니다."); } return $this->_boardName; } public function setBoardName(string $boardName): void { $this->_boardName = $boardName; } public function getBoardTable(): string { if ($this->_boardTable === null) { throw new \Exception("BoardModel이 지정되지 않았습니다."); } return $this->_boardTable; } public function setBoardTable(string $boardTable): void { $this->_boardTable = $boardTable; } public function getBoardLevel(): int { if ($this->_boardLevel === null) { throw new \Exception("BoardModel Level이 지정되지 않았습니다."); } return intval($this->_boardLevel); } public function setBoardLevel(string $boardLevel): void { $this->_boardLevel = $boardLevel; } public function save(string $fileName, string $mediaType, string $content, int $file_sequence) { //망보드 파일관리 table에 등록 try { $entity = parent::save($fileName, $mediaType, $content, $file_sequence); if (!$entity) { return null; } $entity = $this->getEntity(); $entity->user_pid = $this->getUser()->getPK(); $entity->user_name = $this->getUser()->getTitle(); $entity->board_name = $this->getBoardName(); $entity->table_name = $this->getBoardTable(); $entity->reg_date = date("Y-m-d H:i:s"); $entity->file_description = "Filedata"; $entity->setSequence($file_sequence); $entity = $this->getModel()->create($entity); return $entity; } catch (\Exception $e) { log_message("error", $e->getMessage()); return null; } } public function updateFileEntityBoardPK(FileEntity $entity, BoardEntity $boardEntity): FileEntity { $entity->board_pid = $boardEntity->getPK(); return $this->getModel()->modify($entity); } }