From 6206fefceefd3620bab1e98c1fbf6fd5802cd78c Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 15 Dec 2010 23:44:43 -0500 Subject: [PATCH] Starting to switch to a _mergeParent. This will allow un skipping of many tests, and make mergeVars more flexible. --- cake/libs/controller/controller.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index e9d0754d4..de0553b01 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -272,6 +272,15 @@ class Controller extends Object { */ public $validationErrors = null; +/** + * The class name of the parent class you wish to merge with. + * Typically this is AppController, but you may wish to merge vars with a different + * parent class. + * + * @var string + */ + protected $_mergeParent = 'AppController'; + /** * Constructor. * @@ -394,7 +403,7 @@ class Controller extends Object { } /** - * Merge components, helpers, and uses vars from AppController and PluginAppController. + * Merge components, helpers, and uses vars from Controller::$_mergeParent and PluginAppController. * * @return void */ @@ -410,8 +419,8 @@ class Controller extends Object { $plugin = $pluginName . '.'; } - if (is_subclass_of($this, 'AppController') || !empty($pluginController)) { - $appVars = get_class_vars('AppController'); + if (is_subclass_of($this, $this->_mergeParent) || !empty($pluginController)) { + $appVars = get_class_vars($this->_mergeParent); $uses = $appVars['uses']; $merge = array('components', 'helpers'); @@ -430,7 +439,7 @@ class Controller extends Object { ) { $this->uses = array_merge($this->uses, array_diff($appVars['uses'], $this->uses)); } - $this->_mergeVars($merge, 'AppController', true); + $this->_mergeVars($merge, $this->_mergeParent, true); } if ($pluginController && $pluginName != null) {