1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

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
This commit is contained in:
epriestley 2018-12-12 15:47:17 -08:00
parent 5c99163b7c
commit 793f185d29
5 changed files with 18 additions and 23 deletions

View file

@ -12,9 +12,9 @@ foreach ($commits as $commit) {
continue;
}
$data = $commit->loadOneRelative(
new PhabricatorRepositoryCommitData(),
'commitID');
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
'commitID = %d',
$commit->getID());
if (!$data) {
continue;

View file

@ -8,7 +8,9 @@ $commit_table->establishConnection('w');
$edges = 0;
foreach (new LiskMigrationIterator($commit_table) as $commit) {
$data = $commit->loadOneRelative($data_table, 'commitID');
$data = $data_table->loadOneWhere(
'commitID = %d',
$commit->getID());
if (!$data) {
continue;
}

View file

@ -458,14 +458,9 @@ final class PhabricatorUser
}
public function loadPrimaryEmail() {
$email = new PhabricatorUserEmail();
$conn = $email->establishConnection('r');
return $this->loadOneRelative(
$email,
'userPHID',
'getPHID',
qsprintf($conn, '(isPrimary = 1)'));
return id(new PhabricatorUserEmail())->loadOneWhere(
'userPHID = %s AND isPrimary = 1',
$this->getPHID());
}

View file

@ -37,10 +37,9 @@ final class ReleephGetBranchesConduitAPIMethod extends ReleephConduitAPIMethod {
foreach ($branches as $branch) {
$full_branch_name = $branch->getName();
$cut_point_commit = $branch->loadOneRelative(
id(new PhabricatorRepositoryCommit()),
'phid',
'getCutPointCommitPHID');
$cut_point_commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'phid = %s',
$branch->getCutPointCommitPHID());
$results[] = array(
'project' => $project->getName(),

View file

@ -257,18 +257,17 @@ final class ReleephRequest extends ReleephDAO
/* -( Loading external objects )------------------------------------------- */
public function loadPhabricatorRepositoryCommit() {
return $this->loadOneRelative(
new PhabricatorRepositoryCommit(),
'phid',
'getRequestCommitPHID');
return id(new PhabricatorRepositoryCommit())->loadOneWhere(
'phid = %s',
$this->getRequestCommitPHID());
}
public function loadPhabricatorRepositoryCommitData() {
$commit = $this->loadPhabricatorRepositoryCommit();
if ($commit) {
return $commit->loadOneRelative(
new PhabricatorRepositoryCommitData(),
'commitID');
return id(new PhabricatorRepositoryCommitData())->loadOneWhere(
'commitID = %d',
$commit->getID());
}
}