_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->_boardName = $boardTable; } public function getModel(): FileModel { if ($this->_model === null) { return $this->_model = new FileModel(); } return $this->_model; } public function getFileEntity(): null|FileEntity { return $this->_fileEntity; } public function save($content): bool { if (!parent::save($content)) { return false; } //망보드 파일관리 table에 등록 try { //mb_files 모델작업 $entity = new FileEntity(); $entity->setTitle($this->getFileName()); $entity->user_pid = $this->getUser()->getPK(); $entity->user_name = $this->getUser()->getTitle(); $entity->board_name = $this->getBoardName(); $entity->table_name = $this->getBoardTable(); $entity->file_path = $this->getPath(); $entity->file_type = $this->getMimeType(); $entity->reg_date = date("Y-m-d H:i:s"); $this->_fileEntity = $this->getModel()->create($entity); return true; } catch (\Exception $e) { return false; } } }