From 284bf71a8dc9f578ec10908f6bed85a1502c1ffa Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Wed, 3 Oct 2012 15:50:42 -0700 Subject: [PATCH] Fix error when deleting revision Summary: DifferentialAffectedPath has no id or phid key so delete() won't work and we have to do things this other way. Test Plan: deleted a few diffs on my test reproduction. aside from warnings about missing keys (epriestley is on it as I write this) no errors found and diff observed as deleted Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1846 Differential Revision: https://secure.phabricator.com/D3610 --- .../differential/storage/DifferentialRevision.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 91b2594406..e59f864ce1 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -226,12 +226,14 @@ final class DifferentialRevision extends DifferentialDAO { $field->delete(); } - $paths = id(new DifferentialAffectedPath())->loadAllWhere( - 'revisionID = %d', + // we have to do paths a little differentally as they do not have + // an id or phid column for delete() to act on + $dummy_path = new DifferentialAffectedPath(); + queryfx( + $conn_w, + 'DELETE FROM %T WHERE revisionID = %d', + $dummy_path->getTableName(), $this->getID()); - foreach ($paths as $path) { - $path->delete(); - } $result = parent::delete(); $this->saveTransaction();