public function create($postData)
{
if (strlen($postData["body"]) < 10) {
throw new Exception(L::get("SUGGESTION_DESCRIPTION_TOO_SHORT"));
}
if (strlen($postData["subject"]) < 5) {
throw new Exception(L::get("SUGGESTION_TITLE_TOO_SHORT"), 412);
}
$sth = $this->db->prepare("INSERT INTO suggestions(title, body, userid, added) VALUES(?, ?, ?, NOW())");
$sth->bindParam(1, $postData["subject"], PDO::PARAM_INT);
$sth->bindParam(2, $postData["body"], PDO::PARAM_INT);
$sth->bindValue(3, $this->user->getId(), PDO::PARAM_INT);
$sth->execute();
$suggestId = $this->db->lastInsertId();
$topic = $this->forum->addTopic(Config::SUGGESTION_FORUM_ID, $postData["subject"], $postData["body"], $postData["body"], true);
$this->db->query('UPDATE suggestions SET topicid = ' . $topic["id"] . ' WHERE id = ' . $suggestId);
$this->vote($suggestId, "up");
return $topic;
}