public function executeQuery(PhabricatorPolicyAwareQuery $query, AphrontView $pager)
 {
     $query->setViewer($this->requireViewer());
     if ($this->shouldUseOffsetPaging()) {
         $objects = $query->executeWithOffsetPager($pager);
     } else {
         $objects = $query->executeWithCursorPager($pager);
     }
     return $objects;
 }
Пример #2
0
 /**
  * Load an object given a configured query.
  *
  * @param PhabricatorPolicyAwareQuery Configured query.
  * @param list<const> List of required capabilitiy constants, or omit for
  *  defaults.
  * @return object|null Object, or null if no such object exists.
  * @task load
  */
 private function newObjectFromQuery(PhabricatorPolicyAwareQuery $query, array $capabilities = array())
 {
     $viewer = $this->getViewer();
     if (!$capabilities) {
         $capabilities = array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT);
     }
     $object = $query->setViewer($viewer)->requireCapabilities($capabilities)->executeOne();
     if (!$object) {
         return null;
     }
     return $object;
 }