From 81ae9f8fb6a2de05dff61942f9c43f2a99e1da87 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 14 Dec 2015 13:31:07 -0800 Subject: [PATCH] Clean up an issue with meta-editing of edit engines Summary: Ref T9908. These meta-edit-engines are used to generate the main editengine UIs, but they're also editable. Fix an exception when trying to edit the meta editengine. Test Plan: Edited editengineconfiguration editengine. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9908 Differential Revision: https://secure.phabricator.com/D14783 --- .../controller/PhabricatorEditEngineController.php | 7 ------- .../PhabricatorEditEngineConfigurationEditEngine.php | 3 ++- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/applications/transactions/controller/PhabricatorEditEngineController.php b/src/applications/transactions/controller/PhabricatorEditEngineController.php index e7306c7866..9c712f7e3a 100644 --- a/src/applications/transactions/controller/PhabricatorEditEngineController.php +++ b/src/applications/transactions/controller/PhabricatorEditEngineController.php @@ -70,13 +70,6 @@ abstract class PhabricatorEditEngineController ->executeOne(); if ($config) { $engine = $config->getEngine(); - - // TODO: When we're editing the meta-engine, we need to set the engine - // itself as its own target. This is hacky and it would be nice to find - // a cleaner approach later. - if ($engine instanceof PhabricatorEditEngineConfigurationEditEngine) { - $engine->setTargetEngine($engine); - } } return $config; diff --git a/src/applications/transactions/editor/PhabricatorEditEngineConfigurationEditEngine.php b/src/applications/transactions/editor/PhabricatorEditEngineConfigurationEditEngine.php index de667ace4e..0c1c4787db 100644 --- a/src/applications/transactions/editor/PhabricatorEditEngineConfigurationEditEngine.php +++ b/src/applications/transactions/editor/PhabricatorEditEngineConfigurationEditEngine.php @@ -14,7 +14,8 @@ final class PhabricatorEditEngineConfigurationEditEngine public function getTargetEngine() { if (!$this->targetEngine) { - throw new PhutilInvalidStateException('setTargetEngine'); + // If we don't have a target engine, assume we're editing ourselves. + return new PhabricatorEditEngineConfigurationEditEngine(); } return $this->targetEngine; }