'staff_2', 'requestData' => [ 'title' => [ 'validation' => DataValidator::length(1, 100), 'error' => ERRORS::INVALID_NAME ], 'content' => [ 'validation' => DataValidator::length(10), 'error' => ERRORS::INVALID_CONTENT ], 'topicId' => [ 'validation' => DataValidator::dataStoreId('topic'), 'error' => ERRORS::INVALID_TOPIC ] ] ]; } public function handler() { $content = Controller::request('content', true); $fileUploader = FileUploader::getInstance(); $fileUploader->setPermission(FileManager::PERMISSION_ARTICLE); $imagePaths = $this->uploadImages(true); $article = new Article(); $article->setProperties([ 'title' => Controller::request('title'), 'content' => $this->replaceWithImagePaths($imagePaths, $content), 'lastEdited' => Date::getCurrentDate(), 'position' => Controller::request('position') || 1 ]); $topic = Topic::getDataStore(Controller::request('topicId')); $topic->ownArticleList->add($article); $topic->store(); Log::createLog('ADD_ARTICLE', $article->title); Response::respondSuccess([ 'articleId' => $article->store() ]); } }