Changeset View
Changeset View
Standalone View
Standalone View
src/applications/ponder/storage/PonderQuestion.php
<?php | <?php | ||||
final class PonderQuestion extends PonderDAO | final class PonderQuestion extends PonderDAO | ||||
implements | implements | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorMarkupInterface, | PhabricatorMarkupInterface, | ||||
PonderVotableInterface, | PonderVotableInterface, | ||||
PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
PhabricatorFlaggableInterface, | PhabricatorFlaggableInterface, | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorTokenReceiverInterface, | PhabricatorTokenReceiverInterface, | ||||
PhabricatorProjectInterface, | PhabricatorProjectInterface, | ||||
PhabricatorDestructibleInterface { | PhabricatorDestructibleInterface, | ||||
PhabricatorSpacesInterface { | |||||
const MARKUP_FIELD_CONTENT = 'markup:content'; | const MARKUP_FIELD_CONTENT = 'markup:content'; | ||||
protected $title; | protected $title; | ||||
protected $phid; | protected $phid; | ||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $status; | protected $status; | ||||
protected $content; | protected $content; | ||||
protected $contentSource; | protected $contentSource; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
protected $spacePHID; | |||||
protected $voteCount; | protected $voteCount; | ||||
protected $answerCount; | protected $answerCount; | ||||
protected $heat; | protected $heat; | ||||
protected $mailKey; | protected $mailKey; | ||||
private $answers; | private $answers; | ||||
private $vote; | private $vote; | ||||
Show All 14 Lines | public static function initializeNewQuestion(PhabricatorUser $actor) { | ||||
return id(new PonderQuestion()) | return id(new PonderQuestion()) | ||||
->setAuthorPHID($actor->getPHID()) | ->setAuthorPHID($actor->getPHID()) | ||||
->setViewPolicy($view_policy) | ->setViewPolicy($view_policy) | ||||
->setEditPolicy($edit_policy) | ->setEditPolicy($edit_policy) | ||||
->setStatus(PonderQuestionStatus::STATUS_OPEN) | ->setStatus(PonderQuestionStatus::STATUS_OPEN) | ||||
->setVoteCount(0) | ->setVoteCount(0) | ||||
->setAnswerCount(0) | ->setAnswerCount(0) | ||||
->setHeat(0.0); | ->setHeat(0.0) | ||||
->setSpacePHID($actor->getDefaultSpacePHID()); | |||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'title' => 'text255', | 'title' => 'text255', | ||||
'voteCount' => 'sint32', | 'voteCount' => 'sint32', | ||||
▲ Show 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | $this->openTransaction(); | ||||
foreach ($answers as $answer) { | foreach ($answers as $answer) { | ||||
$engine->destroyObject($answer); | $engine->destroyObject($answer); | ||||
} | } | ||||
$this->delete(); | $this->delete(); | ||||
$this->saveTransaction(); | $this->saveTransaction(); | ||||
} | } | ||||
/* -( PhabricatorSpacesInterface )----------------------------------------- */ | |||||
public function getSpacePHID() { | |||||
return $this->spacePHID; | |||||
} | |||||
} | } |