@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+18 -23
+3 -3
resources/sql/patches/20130219.commitsummarymig.php
··· 12 12 continue; 13 13 } 14 14 15 - $data = $commit->loadOneRelative( 16 - new PhabricatorRepositoryCommitData(), 17 - 'commitID'); 15 + $data = id(new PhabricatorRepositoryCommitData())->loadOneWhere( 16 + 'commitID = %d', 17 + $commit->getID()); 18 18 19 19 if (!$data) { 20 20 continue;
+3 -1
resources/sql/patches/20130409.commitdrev.php
··· 8 8 $edges = 0; 9 9 10 10 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()); 12 14 if (!$data) { 13 15 continue; 14 16 }
+3 -8
src/applications/people/storage/PhabricatorUser.php
··· 458 458 } 459 459 460 460 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()); 469 464 } 470 465 471 466
+3 -4
src/applications/releeph/conduit/ReleephGetBranchesConduitAPIMethod.php
··· 37 37 foreach ($branches as $branch) { 38 38 $full_branch_name = $branch->getName(); 39 39 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()); 44 43 45 44 $results[] = array( 46 45 'project' => $project->getName(),
+6 -7
src/applications/releeph/storage/ReleephRequest.php
··· 257 257 /* -( Loading external objects )------------------------------------------- */ 258 258 259 259 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()); 264 263 } 265 264 266 265 public function loadPhabricatorRepositoryCommitData() { 267 266 $commit = $this->loadPhabricatorRepositoryCommit(); 268 267 if ($commit) { 269 - return $commit->loadOneRelative( 270 - new PhabricatorRepositoryCommitData(), 271 - 'commitID'); 268 + return id(new PhabricatorRepositoryCommitData())->loadOneWhere( 269 + 'commitID = %d', 270 + $commit->getID()); 272 271 } 273 272 } 274 273