Changeset View
Changeset View
Standalone View
Standalone View
src/applications/ponder/storage/PonderAnswer.php
Show All 11 Lines | final class PonderAnswer extends PonderDAO | ||||
const MARKUP_FIELD_CONTENT = 'markup:content'; | const MARKUP_FIELD_CONTENT = 'markup:content'; | ||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $questionID; | protected $questionID; | ||||
protected $content; | protected $content; | ||||
protected $mailKey; | protected $mailKey; | ||||
protected $status; | protected $status; | ||||
protected $voteCount; | |||||
private $question = self::ATTACHABLE; | private $question = self::ATTACHABLE; | ||||
private $comments; | private $comments; | ||||
public static function initializeNewAnswer( | public static function initializeNewAnswer( | ||||
PhabricatorUser $actor, | PhabricatorUser $actor, | ||||
PonderQuestion $question) { | PonderQuestion $question) { | ||||
$app = id(new PhabricatorApplicationQuery()) | $app = id(new PhabricatorApplicationQuery()) | ||||
->setViewer($actor) | ->setViewer($actor) | ||||
->withClasses(array('PhabricatorPonderApplication')) | ->withClasses(array('PhabricatorPonderApplication')) | ||||
->executeOne(); | ->executeOne(); | ||||
return id(new PonderAnswer()) | return id(new PonderAnswer()) | ||||
->setQuestionID($question->getID()) | ->setQuestionID($question->getID()) | ||||
->setContent('') | ->setContent('') | ||||
->attachQuestion($question) | ->attachQuestion($question) | ||||
->setAuthorPHID($actor->getPHID()) | ->setAuthorPHID($actor->getPHID()) | ||||
->setVoteCount('0') | ->setVoteCount(0) | ||||
->setStatus(PonderAnswerStatus::ANSWER_STATUS_VISIBLE); | ->setStatus(PonderAnswerStatus::ANSWER_STATUS_VISIBLE); | ||||
} | } | ||||
public function attachQuestion(PonderQuestion $question = null) { | public function attachQuestion(PonderQuestion $question = null) { | ||||
$this->question = $question; | $this->question = $question; | ||||
return $this; | return $this; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines |