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


PHP PhabricatorSavedQuery::setEngineClassName方法代码示例

本文整理汇总了PHP中PhabricatorSavedQuery::setEngineClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorSavedQuery::setEngineClassName方法的具体用法?PHP PhabricatorSavedQuery::setEngineClassName怎么用?PHP PhabricatorSavedQuery::setEngineClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorSavedQuery的用法示例。


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

示例1: saveQuery

 public function saveQuery(PhabricatorSavedQuery $query)
 {
     $query->setEngineClassName(get_class($this));
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     try {
         $query->save();
     } catch (AphrontDuplicateKeyQueryException $ex) {
         // Ignore, this is just a repeated search.
     }
     unset($unguarded);
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:11,代码来源:PhabricatorApplicationSearchEngine.php

示例2: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $type = $request->getURIData('type');
     $action = $request->getURIData('action');
     $query = new PhabricatorSavedQuery();
     $query_str = $request->getStr('query');
     $query->setEngineClassName('PhabricatorSearchApplicationSearchEngine');
     $query->setParameter('query', $query_str);
     $query->setParameter('types', array($type));
     $status_open = PhabricatorSearchRelationship::RELATIONSHIP_OPEN;
     switch ($request->getStr('filter')) {
         case 'assigned':
             $query->setParameter('ownerPHIDs', array($user->getPHID()));
             $query->setParameter('statuses', array($status_open));
             break;
         case 'created':
             $query->setParameter('authorPHIDs', array($user->getPHID()));
             // TODO - if / when we allow pholio mocks to be archived, etc
             // update this
             if ($type != PholioMockPHIDType::TYPECONST) {
                 $query->setParameter('statuses', array($status_open));
             }
             break;
         case 'open':
             $query->setParameter('statuses', array($status_open));
             break;
     }
     $query->setParameter('excludePHIDs', array($request->getStr('exclude')));
     $capabilities = array(PhabricatorPolicyCapability::CAN_VIEW);
     switch ($action) {
         case self::ACTION_MERGE:
             $capabilities[] = PhabricatorPolicyCapability::CAN_EDIT;
             break;
         default:
             break;
     }
     $results = id(new PhabricatorSearchDocumentQuery())->setViewer($user)->requireObjectCapabilities($capabilities)->withSavedQuery($query)->setOffset(0)->setLimit(100)->execute();
     $phids = array_fill_keys(mpull($results, 'getPHID'), true);
     $phids += $this->queryObjectNames($query_str, $capabilities);
     $phids = array_keys($phids);
     $handles = $this->loadViewerHandles($phids);
     $data = array();
     foreach ($handles as $handle) {
         $view = new PhabricatorHandleObjectSelectorDataView($handle);
         $data[] = $view->renderData();
     }
     return id(new AphrontAjaxResponse())->setContent($data);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:49,代码来源:PhabricatorSearchSelectController.php

示例3: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $object = $this->loadRelationshipObject();
     if (!$object) {
         return new Aphront404Response();
     }
     $relationship = $this->loadRelationship($object);
     if (!$relationship) {
         return new Aphront404Response();
     }
     $source = $relationship->newSource();
     $query = new PhabricatorSavedQuery();
     $action = $request->getURIData('action');
     $query_str = $request->getStr('query');
     $filter = $request->getStr('filter');
     $query->setEngineClassName('PhabricatorSearchApplicationSearchEngine');
     $query->setParameter('query', $query_str);
     $types = $source->getResultPHIDTypes();
     $query->setParameter('types', $types);
     $status_open = PhabricatorSearchRelationship::RELATIONSHIP_OPEN;
     switch ($filter) {
         case 'assigned':
             $query->setParameter('ownerPHIDs', array($viewer->getPHID()));
             $query->setParameter('statuses', array($status_open));
             break;
         case 'created':
             $query->setParameter('authorPHIDs', array($viewer->getPHID()));
             $query->setParameter('statuses', array($status_open));
             break;
         case 'open':
             $query->setParameter('statuses', array($status_open));
             break;
     }
     $query->setParameter('excludePHIDs', array($request->getStr('exclude')));
     $capabilities = $relationship->getRequiredRelationshipCapabilities();
     $results = id(new PhabricatorSearchDocumentQuery())->setViewer($viewer)->requireObjectCapabilities($capabilities)->withSavedQuery($query)->setOffset(0)->setLimit(100)->execute();
     $phids = array_fill_keys(mpull($results, 'getPHID'), true);
     $phids = $this->queryObjectNames($query, $capabilities) + $phids;
     $phids = array_keys($phids);
     $handles = $viewer->loadHandles($phids);
     $data = array();
     foreach ($handles as $handle) {
         $view = new PhabricatorHandleObjectSelectorDataView($handle);
         $data[] = $view->renderData();
     }
     return id(new AphrontAjaxResponse())->setContent($data);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:48,代码来源:PhabricatorSearchRelationshipSourceController.php


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