Skip to content

Commit 793f185

Browse files
author
epriestley
committedDec 13, 2018
Remove application callsites to "LiskDAO->loadOneRelative()"
Summary: Ref T13218. This is like `loadOneWhere(...)` but with more dark magic. Get rid of it. Test Plan: - Forced `20130219.commitsummarymig.php` to hit this code and ran it with `bin/storage upgrade --force --apply ...`. - Ran `20130409.commitdrev.php` with `bin/storage upgrade --force --apply ...`. - Called `user.search` to indirectly get primary email information. - Did not test Releeph at all. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13218 Differential Revision: https://secure.phabricator.com/D19876
1 parent 5c99163 commit 793f185

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed
 

‎resources/sql/patches/20130219.commitsummarymig.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
continue;
1313
}
1414

15-
$data = $commit->loadOneRelative(
16-
new PhabricatorRepositoryCommitData(),
17-
'commitID');
15+
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
16+
'commitID = %d',
17+
$commit->getID());
1818

1919
if (!$data) {
2020
continue;

‎resources/sql/patches/20130409.commitdrev.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
$edges = 0;
99

1010
foreach (new LiskMigrationIterator($commit_table) as $commit) {
11-
$data = $commit->loadOneRelative($data_table, 'commitID');
11+
$data = $data_table->loadOneWhere(
12+
'commitID = %d',
13+
$commit->getID());
1214
if (!$data) {
1315
continue;
1416
}

‎src/applications/people/storage/PhabricatorUser.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -458,14 +458,9 @@ public function loadPrimaryEmailAddress() {
458458
}
459459

460460
public function loadPrimaryEmail() {
461-
$email = new PhabricatorUserEmail();
462-
$conn = $email->establishConnection('r');
463-
464-
return $this->loadOneRelative(
465-
$email,
466-
'userPHID',
467-
'getPHID',
468-
qsprintf($conn, '(isPrimary = 1)'));
461+
return id(new PhabricatorUserEmail())->loadOneWhere(
462+
'userPHID = %s AND isPrimary = 1',
463+
$this->getPHID());
469464
}
470465

471466

‎src/applications/releeph/conduit/ReleephGetBranchesConduitAPIMethod.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ protected function execute(ConduitAPIRequest $request) {
3737
foreach ($branches as $branch) {
3838
$full_branch_name = $branch->getName();
3939

40-
$cut_point_commit = $branch->loadOneRelative(
41-
id(new PhabricatorRepositoryCommit()),
42-
'phid',
43-
'getCutPointCommitPHID');
40+
$cut_point_commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
41+
'phid = %s',
42+
$branch->getCutPointCommitPHID());
4443

4544
$results[] = array(
4645
'project' => $project->getName(),

‎src/applications/releeph/storage/ReleephRequest.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,17 @@ public function getSummaryForDisplay() {
257257
/* -( Loading external objects )------------------------------------------- */
258258

259259
public function loadPhabricatorRepositoryCommit() {
260-
return $this->loadOneRelative(
261-
new PhabricatorRepositoryCommit(),
262-
'phid',
263-
'getRequestCommitPHID');
260+
return id(new PhabricatorRepositoryCommit())->loadOneWhere(
261+
'phid = %s',
262+
$this->getRequestCommitPHID());
264263
}
265264

266265
public function loadPhabricatorRepositoryCommitData() {
267266
$commit = $this->loadPhabricatorRepositoryCommit();
268267
if ($commit) {
269-
return $commit->loadOneRelative(
270-
new PhabricatorRepositoryCommitData(),
271-
'commitID');
268+
return id(new PhabricatorRepositoryCommitData())->loadOneWhere(
269+
'commitID = %d',
270+
$commit->getID());
272271
}
273272
}
274273

0 commit comments

Comments
 (0)
Failed to load comments.