当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorEdgeQuery类代码示例

本文整理汇总了PHP中PhabricatorEdgeQuery的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEdgeQuery类的具体用法?PHP PhabricatorEdgeQuery怎么用?PHP PhabricatorEdgeQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PhabricatorEdgeQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadBloggers

 private function loadBloggers(array $blogs)
 {
     assert_instances_of($blogs, 'PhameBlog');
     $blog_phids = mpull($blogs, 'getPHID');
     $edge_types = array(PhabricatorEdgeConfig::TYPE_BLOG_HAS_BLOGGER);
     $query = new PhabricatorEdgeQuery();
     $query->withSourcePHIDs($blog_phids)->withEdgeTypes($edge_types)->execute();
     $all_blogger_phids = $query->getDestinationPHIDs($blog_phids, $edge_types);
     $handles = id(new PhabricatorObjectHandleData($all_blogger_phids))->loadHandles();
     foreach ($blogs as $blog) {
         $blogger_phids = $query->getDestinationPHIDs(array($blog->getPHID()), $edge_types);
         $blog->attachBloggers(array_select_keys($handles, $blogger_phids));
     }
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:14,代码来源:PhameBlogQuery.php

示例2: loadForRevision

 public static function loadForRevision($revision)
 {
     $app_legalpad = 'PhabricatorLegalpadApplication';
     if (!PhabricatorApplication::isClassInstalled($app_legalpad)) {
         return array();
     }
     if (!$revision->getPHID()) {
         return array();
     }
     $phids = PhabricatorEdgeQuery::loadDestinationPHIDs($revision->getPHID(), LegalpadObjectNeedsSignatureEdgeType::EDGECONST);
     if ($phids) {
         // NOTE: We're bypassing permissions to pull these. We have to expose
         // some information about signature status in order to implement this
         // field meaningfully (otherwise, we could not tell reviewers that they
         // can't accept the revision yet), but that's OK because the only way to
         // require signatures is with a "Global" Herald rule, which requires a
         // high level of access.
         $signatures = id(new LegalpadDocumentSignatureQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withDocumentPHIDs($phids)->withSignerPHIDs(array($revision->getAuthorPHID()))->execute();
         $signatures = mpull($signatures, null, 'getDocumentPHID');
         $phids = array_fuse($phids);
         foreach ($phids as $phid) {
             $phids[$phid] = isset($signatures[$phid]);
         }
     }
     return $phids;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:26,代码来源:DifferentialRequiredSignaturesField.php

示例3: save

 public function save()
 {
     if (!$this->object) {
         throw new Exception('Call setObject() before save()!');
     }
     $actor = $this->requireActor();
     $src = $this->object->getPHID();
     if ($this->implicitSubscribePHIDs) {
         $unsub = PhabricatorEdgeQuery::loadDestinationPHIDs($src, PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER);
         $unsub = array_fill_keys($unsub, true);
         $this->implicitSubscribePHIDs = array_diff_key($this->implicitSubscribePHIDs, $unsub);
     }
     $add = $this->implicitSubscribePHIDs + $this->explicitSubscribePHIDs;
     $del = $this->unsubscribePHIDs;
     // If a PHID is marked for both subscription and unsubscription, treat
     // unsubscription as the stronger action.
     $add = array_diff_key($add, $del);
     if ($add || $del) {
         $u_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER;
         $s_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER;
         $editor = new PhabricatorEdgeEditor();
         foreach ($add as $phid => $ignored) {
             $editor->removeEdge($src, $u_type, $phid);
             $editor->addEdge($src, $s_type, $phid);
         }
         foreach ($del as $phid => $ignored) {
             $editor->removeEdge($src, $s_type, $phid);
             $editor->addEdge($src, $u_type, $phid);
         }
         $editor->save();
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:32,代码来源:PhabricatorSubscriptionsEditor.php

示例4: performMerge

 private function performMerge(ManiphestTask $task, PhabricatorObjectHandle $handle, array $phids)
 {
     $user = $this->getRequest()->getUser();
     $response = id(new AphrontReloadResponse())->setURI($handle->getURI());
     $phids = array_fill_keys($phids, true);
     unset($phids[$task->getPHID()]);
     // Prevent merging a task into itself.
     if (!$phids) {
         return $response;
     }
     $targets = id(new ManiphestTaskQuery())->setViewer($user)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->withPHIDs(array_keys($phids))->needSubscriberPHIDs(true)->needProjectPHIDs(true)->execute();
     if (empty($targets)) {
         return $response;
     }
     $editor = id(new ManiphestTransactionEditor())->setActor($user)->setContentSourceFromRequest($this->getRequest())->setContinueOnNoEffect(true)->setContinueOnMissingFields(true);
     $cc_vector = array();
     // since we loaded this via a generic object query, go ahead and get the
     // attach the subscriber and project phids now
     $task->attachSubscriberPHIDs(PhabricatorSubscribersQuery::loadSubscribersForPHID($task->getPHID()));
     $task->attachProjectPHIDs(PhabricatorEdgeQuery::loadDestinationPHIDs($task->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST));
     $cc_vector[] = $task->getSubscriberPHIDs();
     foreach ($targets as $target) {
         $cc_vector[] = $target->getSubscriberPHIDs();
         $cc_vector[] = array($target->getAuthorPHID(), $target->getOwnerPHID());
         $merged_into_txn = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_MERGED_INTO)->setNewValue($task->getPHID());
         $editor->applyTransactions($target, array($merged_into_txn));
     }
     $all_ccs = array_mergev($cc_vector);
     $all_ccs = array_filter($all_ccs);
     $all_ccs = array_unique($all_ccs);
     $add_ccs = id(new ManiphestTransaction())->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)->setNewValue(array('=' => $all_ccs));
     $merged_from_txn = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_MERGED_FROM)->setNewValue(mpull($targets, 'getPHID'));
     $editor->applyTransactions($task, array($add_ccs, $merged_from_txn));
     return $response;
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:35,代码来源:PhabricatorSearchAttachController.php

示例5: readValueFromRevision

 protected function readValueFromRevision(DifferentialRevision $revision)
 {
     if (!$revision->getPHID()) {
         return array();
     }
     return PhabricatorEdgeQuery::loadDestinationPHIDs($revision->getPHID(), DifferentialRevisionHasTaskEdgeType::EDGECONST);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DifferentialManiphestTasksField.php

示例6: saveVote

 public function saveVote()
 {
     if (!$this->votable) {
         throw new Exception("Must set votable before saving vote");
     }
     if (!$this->user) {
         throw new Exception("Must set user before saving vote");
     }
     $user = $this->user;
     $votable = $this->votable;
     $newvote = $this->vote;
     // prepare vote add, or update if this user is amending an
     // earlier vote
     $editor = id(new PhabricatorEdgeEditor())->setUser($user)->addEdge($user->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID(), array('data' => $newvote))->removeEdge($user->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     $conn = $votable->establishConnection('w');
     $trans = $conn->openTransaction();
     $trans->beginReadLocking();
     $votable->reload();
     $curvote = (int) PhabricatorEdgeQuery::loadSingleEdgeData($user->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     if (!$curvote) {
         $curvote = PonderConstants::NONE_VOTE;
     }
     // adjust votable's score by this much
     $delta = $newvote - $curvote;
     queryfx($conn, 'UPDATE %T as t
     SET t.`voteCount` = t.`voteCount` + %d
     WHERE t.`PHID` = %s', $votable->getTableName(), $delta, $votable->getVotablePHID());
     $editor->save();
     $trans->endReadLocking();
     $trans->saveTransaction();
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:31,代码来源:PonderVoteEditor.php

示例7: processDiffusionRequest

 protected function processDiffusionRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $drequest = $this->getDiffusionRequest();
     $callsign = $drequest->getRepository()->getCallsign();
     $repository = $drequest->getRepository();
     $commit = $drequest->loadCommit();
     $data = $commit->loadCommitData();
     $page_title = pht('Edit Diffusion Commit');
     if (!$commit) {
         return new Aphront404Response();
     }
     $commit_phid = $commit->getPHID();
     $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
     $current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($commit_phid, $edge_type);
     if ($request->isFormPost()) {
         $xactions = array();
         $proj_phids = $request->getArr('projects');
         $xactions[] = id(new PhabricatorAuditTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $edge_type)->setNewValue(array('=' => array_fuse($proj_phids)));
         $editor = id(new PhabricatorAuditEditor())->setActor($user)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request);
         $xactions = $editor->applyTransactions($commit, $xactions);
         return id(new AphrontRedirectResponse())->setURI('/r' . $callsign . $commit->getCommitIdentifier());
     }
     $tokenizer_id = celerity_generate_unique_node_id();
     $form = id(new AphrontFormView())->setUser($user)->setAction($request->getRequestURI()->getPath())->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($current_proj_phids)->setID($tokenizer_id)->setCaption(javelin_tag('a', array('href' => '/project/create/', 'mustcapture' => true, 'sigil' => 'project-create'), pht('Create New Project')))->setDatasource(new PhabricatorProjectDatasource()));
     $reason = $data->getCommitDetail('autocloseReason', false);
     $reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
     if ($reason !== false) {
         switch ($reason) {
             case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
                 $desc = pht('No, Repository Importing');
                 break;
             case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
                 $desc = pht('No, Autoclose Disabled');
                 break;
             case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH:
                 $desc = pht('No, Not On Autoclose Branch');
                 break;
             case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED:
                 $desc = pht('Yes, Forced Via bin/repository CLI Tool.');
                 break;
             case null:
                 $desc = pht('Yes');
                 break;
             default:
                 $desc = pht('Unknown');
                 break;
         }
         $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
         $doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Learn More'));
         $form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Autoclose?'))->setValue(array($desc, " · ", $doc_link)));
     }
     Javelin::initBehavior('project-create', array('tokenizerID' => $tokenizer_id));
     $submit = id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton('/r' . $callsign . $commit->getCommitIdentifier());
     $form->appendChild($submit);
     $crumbs = $this->buildCrumbs(array('commit' => true));
     $crumbs->addTextCrumb(pht('Edit'));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText($page_title)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $page_title));
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:60,代码来源:DiffusionCommitEditController.php

示例8: buildAbstractDocumentByPHID

 protected function buildAbstractDocumentByPHID($phid)
 {
     $commit = $this->loadDocumentByPHID($phid);
     $commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID());
     $date_created = $commit->getEpoch();
     $commit_message = $commit_data->getCommitMessage();
     $author_phid = $commit_data->getCommitDetail('authorPHID');
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($this->getViewer())->withIDs(array($commit->getRepositoryID()))->executeOne();
     if (!$repository) {
         throw new Exception('No such repository!');
     }
     $title = 'r' . $repository->getCallsign() . $commit->getCommitIdentifier() . ' ' . $commit_data->getSummary();
     $doc = new PhabricatorSearchAbstractDocument();
     $doc->setPHID($commit->getPHID());
     $doc->setDocumentType(PhabricatorRepositoryCommitPHIDType::TYPECONST);
     $doc->setDocumentCreated($date_created);
     $doc->setDocumentModified($date_created);
     $doc->setDocumentTitle($title);
     $doc->addField(PhabricatorSearchField::FIELD_BODY, $commit_message);
     if ($author_phid) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $author_phid, PhabricatorPeopleUserPHIDType::TYPECONST, $date_created);
     }
     $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($commit->getPHID(), PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT);
     if ($project_phids) {
         foreach ($project_phids as $project_phid) {
             $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_PROJECT, $project_phid, PhabricatorProjectProjectPHIDType::TYPECONST, $date_created);
         }
     }
     $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, $repository->getPHID(), PhabricatorRepositoryRepositoryPHIDType::TYPECONST, $date_created);
     $this->indexTransactions($doc, new PhabricatorAuditTransactionQuery(), array($commit->getPHID()));
     return $doc;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:32,代码来源:PhabricatorRepositoryCommitSearchIndexer.php

示例9: receiveEmail

 protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail)
 {
     $conpherence = $this->getMailReceiver();
     $user = $this->getActor();
     if (!$conpherence->getPHID()) {
         $conpherence->attachParticipants(array())->attachFilePHIDs(array());
     } else {
         $edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
         $file_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($conpherence->getPHID(), $edge_type);
         $conpherence->attachFilePHIDs($file_phids);
         $participants = id(new ConpherenceParticipant())->loadAllWhere('conpherencePHID = %s', $conpherence->getPHID());
         $participants = mpull($participants, null, 'getParticipantPHID');
         $conpherence->attachParticipants($participants);
     }
     $content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_EMAIL, array('id' => $mail->getID()));
     $editor = id(new ConpherenceEditor())->setActor($user)->setContentSource($content_source)->setParentMessageID($mail->getMessageID());
     $body = $mail->getCleanTextBody();
     $body = $this->enhanceBodyWithAttachments($body, $mail->getAttachments());
     $xactions = array();
     if ($this->getMailAddedParticipantPHIDs()) {
         $xactions[] = id(new ConpherenceTransaction())->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)->setNewValue(array('+' => $this->getMailAddedParticipantPHIDs()));
     }
     $xactions = array_merge($xactions, $editor->generateTransactionsFromText($user, $conpherence, $body));
     $editor->applyTransactions($conpherence, $xactions);
     return $conpherence;
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:26,代码来源:ConpherenceReplyHandler.php

示例10: saveVote

 public function saveVote()
 {
     $actor = $this->requireActor();
     if (!$this->votable) {
         throw new PhutilInvalidStateException('setVotable');
     }
     $votable = $this->votable;
     $newvote = $this->vote;
     // prepare vote add, or update if this user is amending an
     // earlier vote
     $editor = id(new PhabricatorEdgeEditor())->addEdge($actor->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID(), array('data' => $newvote))->removeEdge($actor->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     $conn = $votable->establishConnection('w');
     $trans = $conn->openTransaction();
     $trans->beginReadLocking();
     $votable->reload();
     $curvote = (int) PhabricatorEdgeQuery::loadSingleEdgeData($actor->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     if (!$curvote) {
         $curvote = PonderVote::VOTE_NONE;
     }
     // Adjust votable's score by this much.
     $delta = $newvote - $curvote;
     queryfx($conn, 'UPDATE %T as t
     SET t.voteCount = t.voteCount + %d
     WHERE t.PHID = %s', $votable->getTableName(), $delta, $votable->getVotablePHID());
     $editor->save();
     $trans->endReadLocking();
     $trans->saveTransaction();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:28,代码来源:PonderVoteEditor.php

示例11: save

 public function save()
 {
     if (!$this->object) {
         throw new PhutilInvalidStateException('setObject');
     }
     $actor = $this->requireActor();
     $src = $this->object->getPHID();
     if ($this->implicitSubscribePHIDs) {
         $unsub = PhabricatorEdgeQuery::loadDestinationPHIDs($src, PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST);
         $unsub = array_fill_keys($unsub, true);
         $this->implicitSubscribePHIDs = array_diff_key($this->implicitSubscribePHIDs, $unsub);
     }
     $add = $this->implicitSubscribePHIDs + $this->explicitSubscribePHIDs;
     $del = $this->unsubscribePHIDs;
     // If a PHID is marked for both subscription and unsubscription, treat
     // unsubscription as the stronger action.
     $add = array_diff_key($add, $del);
     if ($add || $del) {
         $u_type = PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST;
         $s_type = PhabricatorObjectHasSubscriberEdgeType::EDGECONST;
         $editor = new PhabricatorEdgeEditor();
         foreach ($add as $phid => $ignored) {
             $editor->removeEdge($src, $u_type, $phid);
             $editor->addEdge($src, $s_type, $phid);
         }
         foreach ($del as $phid => $ignored) {
             $editor->removeEdge($src, $s_type, $phid);
             $editor->addEdge($src, $u_type, $phid);
         }
         $editor->save();
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:32,代码来源:PhabricatorSubscriptionsEditor.php

示例12: handleHovercardEvent

 private function handleHovercardEvent($event)
 {
     $viewer = $event->getUser();
     $hovercard = $event->getValue('hovercard');
     $object_handle = $event->getValue('handle');
     $commit = $event->getValue('object');
     if (!$commit instanceof PhabricatorRepositoryCommit) {
         return;
     }
     $commit_data = $commit->loadCommitData();
     $revision = PhabricatorEdgeQuery::loadDestinationPHIDs($commit->getPHID(), PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV);
     $revision = reset($revision);
     $author = $commit->getAuthorPHID();
     $phids = array_filter(array($revision, $author));
     $handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($phids)->execute();
     if ($author) {
         $author = $handles[$author]->renderLink();
     } else {
         $author = phutil_tag('em', array(), $commit_data->getAuthorName());
     }
     $hovercard->setTitle($object_handle->getName());
     $hovercard->setDetail($commit->getSummary());
     $hovercard->addField(pht('Author'), $author);
     $hovercard->addField(pht('Date'), phabricator_date($commit->getEpoch(), $viewer));
     if ($commit->getAuditStatus() != PhabricatorAuditCommitStatusConstants::NONE) {
         $hovercard->addField(pht('Audit Status'), PhabricatorAuditCommitStatusConstants::getStatusName($commit->getAuditStatus()));
     }
     if ($revision) {
         $rev_handle = $handles[$revision];
         $hovercard->addField(pht('Revision'), $rev_handle->renderLink());
     }
     $event->setValue('hovercard', $hovercard);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:33,代码来源:DiffusionHovercardEventListener.php

示例13: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($this->id) {
         $question = id(new PonderQuestionQuery())->setViewer($user)->withIDs(array($this->id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
         if (!$question) {
             return new Aphront404Response();
         }
         $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs($question->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
         $v_projects = array_reverse($v_projects);
     } else {
         $question = id(new PonderQuestion())->setStatus(PonderQuestionStatus::STATUS_OPEN)->setAuthorPHID($user->getPHID())->setVoteCount(0)->setAnswerCount(0)->setHeat(0.0);
         $v_projects = array();
     }
     $v_title = $question->getTitle();
     $v_content = $question->getContent();
     $errors = array();
     $e_title = true;
     if ($request->isFormPost()) {
         $v_title = $request->getStr('title');
         $v_content = $request->getStr('content');
         $v_projects = $request->getArr('projects');
         $len = phutil_utf8_strlen($v_title);
         if ($len < 1) {
             $errors[] = pht('Title must not be empty.');
             $e_title = pht('Required');
         } else {
             if ($len > 255) {
                 $errors[] = pht('Title is too long.');
                 $e_title = pht('Too Long');
             }
         }
         if (!$errors) {
             $template = id(new PonderQuestionTransaction());
             $xactions = array();
             $xactions[] = id(clone $template)->setTransactionType(PonderQuestionTransaction::TYPE_TITLE)->setNewValue($v_title);
             $xactions[] = id(clone $template)->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT)->setNewValue($v_content);
             $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
             $xactions[] = id(new PonderQuestionTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $proj_edge_type)->setNewValue(array('=' => array_fuse($v_projects)));
             $editor = id(new PonderQuestionEditor())->setActor($user)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true);
             $editor->applyTransactions($question, $xactions);
             return id(new AphrontRedirectResponse())->setURI('/Q' . $question->getID());
         }
     }
     $form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Question'))->setName('title')->setValue($v_title)->setError($e_title))->appendChild(id(new PhabricatorRemarkupControl())->setUser($user)->setName('content')->setID('content')->setValue($v_content)->setLabel(pht('Description'))->setUser($user));
     $form->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($v_projects)->setDatasource(new PhabricatorProjectDatasource()));
     $form->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($this->getApplicationURI())->setValue(pht('Ask Away!')));
     $preview = id(new PHUIRemarkupPreviewPanel())->setHeader(pht('Question Preview'))->setControlID('content')->setPreviewURI($this->getApplicationURI('preview/'));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Ask New Question'))->setFormErrors($errors)->setForm($form);
     $crumbs = $this->buildApplicationCrumbs();
     $id = $question->getID();
     if ($id) {
         $crumbs->addTextCrumb("Q{$id}", "/Q{$id}");
         $crumbs->addTextCrumb(pht('Edit'));
     } else {
         $crumbs->addTextCrumb(pht('Ask Question'));
     }
     return $this->buildApplicationPage(array($crumbs, $form_box, $preview), array('title' => pht('Ask New Question')));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:60,代码来源:PonderQuestionEditController.php

示例14: getHeraldFieldValue

 public function getHeraldFieldValue($object)
 {
     $repository = $this->getAdapter()->loadRepository();
     if (!$repository) {
         return array();
     }
     return PhabricatorEdgeQuery::loadDestinationPHIDs($repository->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:DifferentialRevisionRepositoryProjectsHeraldField.php

示例15: getDependentRevisionPHIDs

 private function getDependentRevisionPHIDs()
 {
     $requested_object = $this->getObject()->getRequestedObjectPHID();
     if (!$requested_object instanceof DifferentialRevision) {
         return array();
     }
     $revision = $requested_object;
     return PhabricatorEdgeQuery::loadDestinationPHIDs($revision->getPHID(), DifferentialRevisionDependsOnRevisionEdgeType::EDGECONST);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:ReleephDependsOnFieldSpecification.php


注:本文中的PhabricatorEdgeQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。