public function execute() { $table = new DifferentialTransactionComment(); $conn_r = $table->establishConnection('r'); $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildLimitClause($conn_r)); $comments = $table->loadAllFromArray($data); foreach ($comments as $key => $value) { $comments[$key] = DifferentialInlineComment::newFromModernComment($value); } return $comments; }
public static function loadUnsubmittedInlineComments(PhabricatorUser $viewer, DifferentialRevision $revision) { // TODO: This probably needs to move somewhere more central as we move // away from DifferentialInlineCommentQuery, but // PhabricatorApplicationTransactionCommentQuery is currently `final` and // I'm not yet decided on how to approach that. For now, just get the PHIDs // and then execute a PHID-based query through the standard stack. $table = new DifferentialTransactionComment(); $conn_r = $table->establishConnection('r'); $phids = queryfx_all($conn_r, 'SELECT phid FROM %T WHERE revisionPHID = %s AND authorPHID = %s AND transactionPHID IS NULL', $table->getTableName(), $revision->getPHID(), $viewer->getPHID()); $phids = ipull($phids, 'phid'); if (!$phids) { return array(); } return id(new PhabricatorApplicationTransactionCommentQuery())->setTemplate(new DifferentialTransactionComment())->setViewer($viewer)->withPHIDs($phids)->execute(); }
public function execute() { $table = new DifferentialTransactionComment(); $conn_r = $table->establishConnection('r'); $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildLimitClause($conn_r)); $comments = $table->loadAllFromArray($data); if ($this->needHidden) { $viewer_phid = $this->getViewer()->getPHID(); if ($viewer_phid && $comments) { $hidden = queryfx_all($conn_r, 'SELECT commentID FROM %T WHERE userPHID = %s AND commentID IN (%Ls)', id(new DifferentialHiddenComment())->getTableName(), $viewer_phid, mpull($comments, 'getID')); $hidden = array_fuse(ipull($hidden, 'commentID')); } else { $hidden = array(); } foreach ($comments as $inline) { $inline->attachIsHidden(isset($hidden[$inline->getID()])); } } foreach ($comments as $key => $value) { $comments[$key] = DifferentialInlineComment::newFromModernComment($value); } return $comments; }
protected function applyBuiltinExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_INLINESTATE: $table = new DifferentialTransactionComment(); $conn_w = $table->establishConnection('w'); foreach ($xaction->getNewValue() as $phid => $state) { queryfx($conn_w, 'UPDATE %T SET fixedState = %s WHERE phid = %s', $table->getTableName(), $state, $phid); } break; } return parent::applyBuiltinExternalTransaction($object, $xaction); }