Differential D21184 Diff 50520 src/applications/differential/storage/DifferentialTransactionComment.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialTransactionComment.php
| <?php | <?php | ||||
| final class DifferentialTransactionComment | final class DifferentialTransactionComment | ||||
| extends PhabricatorApplicationTransactionComment { | extends PhabricatorApplicationTransactionComment { | ||||
| protected $revisionPHID; | protected $revisionPHID; | ||||
| protected $changesetID; | protected $changesetID; | ||||
| protected $isNewFile = 0; | protected $isNewFile = 0; | ||||
| protected $lineNumber = 0; | protected $lineNumber = 0; | ||||
| protected $lineLength = 0; | protected $lineLength = 0; | ||||
| protected $fixedState; | protected $fixedState; | ||||
| protected $hasReplies = 0; | protected $hasReplies = 0; | ||||
| protected $replyToCommentPHID; | protected $replyToCommentPHID; | ||||
| protected $attributes = array(); | |||||
| private $replyToComment = self::ATTACHABLE; | private $replyToComment = self::ATTACHABLE; | ||||
| private $isHidden = self::ATTACHABLE; | private $isHidden = self::ATTACHABLE; | ||||
| private $changeset = self::ATTACHABLE; | private $changeset = self::ATTACHABLE; | ||||
| public function getApplicationTransactionObject() { | public function getApplicationTransactionObject() { | ||||
| return new DifferentialTransaction(); | return new DifferentialTransaction(); | ||||
| } | } | ||||
| public function attachReplyToComment( | public function attachReplyToComment( | ||||
| DifferentialTransactionComment $comment = null) { | DifferentialTransactionComment $comment = null) { | ||||
| $this->replyToComment = $comment; | $this->replyToComment = $comment; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getReplyToComment() { | public function getReplyToComment() { | ||||
| return $this->assertAttached($this->replyToComment); | return $this->assertAttached($this->replyToComment); | ||||
| } | } | ||||
| protected function getConfiguration() { | protected function getConfiguration() { | ||||
| $config = parent::getConfiguration(); | $config = parent::getConfiguration(); | ||||
| $config[self::CONFIG_COLUMN_SCHEMA] = array( | $config[self::CONFIG_COLUMN_SCHEMA] = array( | ||||
| 'revisionPHID' => 'phid?', | 'revisionPHID' => 'phid?', | ||||
| 'changesetID' => 'id?', | 'changesetID' => 'id?', | ||||
| 'isNewFile' => 'bool', | 'isNewFile' => 'bool', | ||||
| 'lineNumber' => 'uint32', | 'lineNumber' => 'uint32', | ||||
| 'lineLength' => 'uint32', | 'lineLength' => 'uint32', | ||||
| 'fixedState' => 'text12?', | 'fixedState' => 'text12?', | ||||
| 'hasReplies' => 'bool', | 'hasReplies' => 'bool', | ||||
| 'replyToCommentPHID' => 'phid?', | 'replyToCommentPHID' => 'phid?', | ||||
| ) + $config[self::CONFIG_COLUMN_SCHEMA]; | ) + $config[self::CONFIG_COLUMN_SCHEMA]; | ||||
| $config[self::CONFIG_KEY_SCHEMA] = array( | $config[self::CONFIG_KEY_SCHEMA] = array( | ||||
| 'key_draft' => array( | 'key_draft' => array( | ||||
| 'columns' => array('authorPHID', 'transactionPHID'), | 'columns' => array('authorPHID', 'transactionPHID'), | ||||
| ), | ), | ||||
| 'key_changeset' => array( | 'key_changeset' => array( | ||||
| 'columns' => array('changesetID'), | 'columns' => array('changesetID'), | ||||
| ), | ), | ||||
| 'key_revision' => array( | 'key_revision' => array( | ||||
| 'columns' => array('revisionPHID'), | 'columns' => array('revisionPHID'), | ||||
| ), | ), | ||||
| ) + $config[self::CONFIG_KEY_SCHEMA]; | ) + $config[self::CONFIG_KEY_SCHEMA]; | ||||
| $config[self::CONFIG_SERIALIZATION] = array( | |||||
| 'attributes' => self::SERIALIZATION_JSON, | |||||
| ) + idx($config, self::CONFIG_SERIALIZATION, array()); | |||||
| return $config; | return $config; | ||||
| } | } | ||||
| public function shouldUseMarkupCache($field) { | public function shouldUseMarkupCache($field) { | ||||
| // Only cache submitted comments. | // Only cache submitted comments. | ||||
| return ($this->getTransactionPHID() != null); | return ($this->getTransactionPHID() != null); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||