From c679b78270691212ce845858404d0909231570ab Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 22 Oct 2012 16:25:31 -0700 Subject: [PATCH] Fix some Editor issues Summary: The property is called 'actor', not 'user'. Extend from Phobject to catch this class of error automatically. Upgrade a couple of getActor() to requireActor(). Test Plan: Created new users. Reviewers: btrahan, vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D3776 --- src/applications/people/PhabricatorUserEditor.php | 7 +++---- src/infrastructure/PhabricatorEditor.php | 11 +++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/applications/people/PhabricatorUserEditor.php b/src/applications/people/PhabricatorUserEditor.php index 9f811e42c5..ec734cc6b9 100644 --- a/src/applications/people/PhabricatorUserEditor.php +++ b/src/applications/people/PhabricatorUserEditor.php @@ -75,7 +75,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor { } $log = PhabricatorUserLog::newLog( - $this->getActor(), + $this->requireActor(), $user, PhabricatorUserLog::ACTION_CREATE); $log->setNewValue($email->getAddress()); @@ -97,7 +97,6 @@ final class PhabricatorUserEditor extends PhabricatorEditor { throw new Exception("User has not been created yet!"); } - $actor = $this->requireActor(); $user->openTransaction(); $user->save(); if ($email) { @@ -105,7 +104,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor { } $log = PhabricatorUserLog::newLog( - $actor, + $this->requireActor(), $user, PhabricatorUserLog::ACTION_EDIT); $log->save(); @@ -134,7 +133,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor { $user->save(); $log = PhabricatorUserLog::newLog( - $this->getActor(), + $this->requireActor(), $user, PhabricatorUserLog::ACTION_CHANGE_PASSWORD); $log->save(); diff --git a/src/infrastructure/PhabricatorEditor.php b/src/infrastructure/PhabricatorEditor.php index df6e901541..d92322b999 100644 --- a/src/infrastructure/PhabricatorEditor.php +++ b/src/infrastructure/PhabricatorEditor.php @@ -16,18 +16,20 @@ * limitations under the License. */ -abstract class PhabricatorEditor { +abstract class PhabricatorEditor extends Phobject { private $actor; private $excludeMailRecipientPHIDs = array(); - final public function setActor(PhabricatorUser $user) { - $this->user = $user; + final public function setActor(PhabricatorUser $actor) { + $this->actor = $actor; return $this; } + final protected function getActor() { - return $this->user; + return $this->actor; } + final protected function requireActor() { $actor = $this->getActor(); if (!$actor) { @@ -40,6 +42,7 @@ abstract class PhabricatorEditor { $this->excludeMailRecipientPHIDs = $phids; return $this; } + final protected function getExcludeMailRecipientPHIDs() { return $this->excludeMailRecipientPHIDs; }