mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +01:00
Convert simple query subclasses to use internal cursors
Summary: Depends on D20291. Ref T13259. Move all the simple cases (where paging depends only on the partial object and does not depend on keys) to a simple wrapper. This leaves a smaller set of more complex cases where we care about external data or which keys were requested that I'll convert in followups. Test Plan: Poked at things, but a lot of stuff is still broken until everything is converted. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13259 Differential Revision: https://secure.phabricator.com/D20292
This commit is contained in:
parent
1b0ef43910
commit
d4847c3eeb
20 changed files with 61 additions and 84 deletions
|
@ -122,11 +122,10 @@ final class AlmanacDeviceQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$device = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $device->getID(),
|
||||
'name' => $device->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,11 +79,10 @@ final class AlmanacNamespaceQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$namespace = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $namespace->getID(),
|
||||
'name' => $namespace->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -206,11 +206,10 @@ final class AlmanacServiceQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$service = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $service->getID(),
|
||||
'name' => $service->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,11 +108,11 @@ final class PhabricatorBadgesQuery
|
|||
) + parent::getOrderableColumns();
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$badge = $this->loadCursorObject($cursor);
|
||||
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'quality' => $badge->getQuality(),
|
||||
'id' => $badge->getID(),
|
||||
'id' => (int)$object->getID(),
|
||||
'quality' => $object->getQuality(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -140,11 +140,10 @@ final class PhabricatorCalendarEventQuery
|
|||
) + parent::getOrderableColumns();
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$event = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'start' => $event->getStartDateTimeEpoch(),
|
||||
'id' => $event->getID(),
|
||||
'id' => (int)$object->getID(),
|
||||
'start' => (int)$object->getStartDateTimeEpoch(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,11 +97,10 @@ final class PhabricatorCountdownQuery
|
|||
) + parent::getOrderableColumns();
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$countdown = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'epoch' => $countdown->getEpoch(),
|
||||
'id' => $countdown->getID(),
|
||||
'id' => (int)$object->getID(),
|
||||
'epoch' => (int)$object->getEpoch(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -800,11 +800,10 @@ final class DifferentialRevisionQuery
|
|||
) + parent::getOrderableColumns();
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$revision = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $revision->getID(),
|
||||
'updated' => $revision->getDateModified(),
|
||||
'id' => (int)$object->getID(),
|
||||
'updated' => (int)$object->getDateModified(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -924,11 +924,10 @@ final class DiffusionCommitQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$commit = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $commit->getID(),
|
||||
'epoch' => $commit->getEpoch(),
|
||||
'id' => (int)$object->getID(),
|
||||
'epoch' => (int)$object->getEpoch(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -181,11 +181,10 @@ final class DivinerBookQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$book = $this->loadCursorObject($cursor);
|
||||
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'name' => $book->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,11 +133,10 @@ final class HarbormasterBuildPlanQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$plan = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $plan->getID(),
|
||||
'name' => $plan->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -249,11 +249,10 @@ final class PhabricatorMacroQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$macro = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $macro->getID(),
|
||||
'name' => $macro->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -267,11 +267,10 @@ final class PhabricatorOwnersPackageQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$package = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $package->getID(),
|
||||
'name' => $package->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -379,11 +379,10 @@ final class PhabricatorPeopleQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$user = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $user->getID(),
|
||||
'username' => $user->getUsername(),
|
||||
'id' => (int)$object->getID(),
|
||||
'username' => $object->getUsername(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,15 +171,11 @@ final class PhamePostQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$post = $this->loadCursorObject($cursor);
|
||||
|
||||
$map = array(
|
||||
'datePublished' => $post->getDatePublished(),
|
||||
'id' => $post->getID(),
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => (int)$object->getID(),
|
||||
'datePublished' => (int)$object->getDatePublished(),
|
||||
);
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
public function getQueryApplicationClass() {
|
||||
|
|
|
@ -81,9 +81,9 @@ final class PhluxVariableQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$object = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => (int)$object->getID(),
|
||||
'key' => $object->getVariableKey(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -133,12 +133,11 @@ final class PhrequentUserTimeQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$usertime = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $usertime->getID(),
|
||||
'start' => $usertime->getDateStarted(),
|
||||
'end' => $usertime->getDateEnded(),
|
||||
'id' => (int)$object->getID(),
|
||||
'start' => (int)$object->getDateStarted(),
|
||||
'end' => (int)$object->getDateEnded(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,13 +50,6 @@ final class PhabricatorPhurlURLQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$url = $this->loadCursorObject($cursor);
|
||||
return array(
|
||||
'id' => $url->getID(),
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadPage() {
|
||||
return $this->loadStandardPage($this->newResultObject());
|
||||
}
|
||||
|
|
|
@ -201,12 +201,11 @@ final class PhabricatorProjectQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$project = $this->loadCursorObject($cursor);
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $project->getID(),
|
||||
'name' => $project->getName(),
|
||||
'status' => $project->getStatus(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
'status' => $object->getStatus(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,12 +130,10 @@ final class ReleephProductQuery
|
|||
);
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$product = $this->loadCursorObject($cursor);
|
||||
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => $product->getID(),
|
||||
'name' => $product->getName(),
|
||||
'id' => (int)$object->getID(),
|
||||
'name' => $object->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,10 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
|
||||
$object = $cursor->getObject();
|
||||
|
||||
return $this->newPagingMapFromPartialObject($object);
|
||||
}
|
||||
|
||||
protected function newPagingMapFromPartialObject($object) {
|
||||
return array(
|
||||
'id' => (int)$object->getID(),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue