/** * Removes an answer from the given question. * @param string $databaseName * @param string $questionId * @param string $answerId * @param string $commentId * @return int */ public static function removeComment($databaseName, $questionId, $answerId, $commentId) { $mapper = QuestionModelMongoMapper::connect($databaseName); // TODO Review, what should we return CP 2013-08 return $mapper->removeSubDocument($questionId, "answers.{$answerId}.comments", $commentId); }
/** * QuestionAnswersListModel constructor. * @param MapperModel $projectModel * @param array $textId */ public function __construct($projectModel, $textId) { parent::__construct(QuestionModelMongoMapper::connect($projectModel->databaseName()), array('description' => array('$regex' => ''), 'textRef' => MongoMapper::mongoID($textId)), array('title', 'description', 'answers', 'isArchived'), array('dateCreated' => -1)); }
/** * @param ProjectModel $projectModel * @param string $textId */ public function __construct($projectModel, $textId) { parent::__construct(QuestionModelMongoMapper::connect($projectModel->databaseName()), array('description' => array('$regex' => ''), 'textRef' => MongoMapper::mongoID($textId)), array('description')); }