<?php

echo "Backfilling commit summaries...\n";

$commits = new LiskMigrationIterator(new PhabricatorRepositoryCommit());
foreach ($commits as $commit) {
  echo 'Filling Commit #'.$commit->getID()."\n";

  if (strlen($commit->getSummary())) {
    continue;
  }

  $data = $commit->loadOneRelative(
    new PhabricatorRepositoryCommitData(),
    'commitID');

  if (!$data) {
    continue;
  }

  $commit->setSummary($data->getSummary());
  $commit->save();
}

echo "Done.\n";

<?php

echo "Backfilling commit summaries...\n";

$commits = new LiskMigrationIterator(new PhabricatorRepositoryCommit());
foreach ($commits as $commit) {
  echo 'Filling Commit #'.$commit->getID()."\n";

  if (strlen($commit->getSummary())) {
    continue;
  }

  $data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
    'commitID = %d',
    $commit->getID());

  if (!$data) {
    continue;
  }

  $commit->setSummary($data->getSummary());
  $commit->save();
}

echo "Done.\n";

--- 
+++ 
@@ -10,9 +10,9 @@
     continue;
   }
 
-  $data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
-    'commitID = %d',
-    $commit->getID());
+  $data = $commit->loadOneRelative(
+    new PhabricatorRepositoryCommitData(),
+    'commitID');
 
   if (!$data) {
     continue;
Use relatives in commit summary migration

Test Plan: Ran it on test DB.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5061
