Skip to content
Permalink
Browse files

Starting to switch to a _mergeParent. This will allow un skipping of …

…many tests, and make mergeVars more flexible.
  • Loading branch information...
markstory committed Dec 16, 2010
1 parent 862a2bc commit 6206fefceefd3620bab1e98c1fbf6fd5802cd78c
Showing with 13 additions and 4 deletions.
  1. +13 −4 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 @@ public function setRequest(CakeRequest $request) {
}
/**
* 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 @@ protected function __mergeVars() {
$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 @@ protected function __mergeVars() {
) {
$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) {

0 comments on commit 6206fef

Please sign in to comment.
You can’t perform that action at this time.