'staff_2', 'requestData' => [ 'topicId' => [ 'validation' => DataValidator::dataStoreId('topic'), 'error' => ERRORS::INVALID_TOPIC ], 'name' => [ 'validation' => DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_NAME, LengthConfig::MAX_LENGTH_NAME), 'error' => ERRORS::INVALID_TITLE ] ] ]; } public function handler() { $topic = Topic::getDataStore(Controller::request('topicId')); $name = Controller::request('name'); $iconColor = Controller::request('iconColor'); $private = Controller::request('private'); $icon = Controller::request('icon'); $createdArticleTookByName = Topic::getDataStore($name, 'name'); if(!$createdArticleTookByName->isNull() && $topic->id !== $createdArticleTookByName->id){ throw new RequestException(ERRORS::NAME_ALREADY_USED); } if($name) { $topic->name = Controller::request('name', true); } if($iconColor) { $topic->iconColor = $iconColor; } if($icon) { $topic->icon = $icon; } if ($private !== null) { $topic->private = $private; } $topic->store(); Response::respondSuccess(); } }