mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Starting to switch to a _mergeParent. This will allow un skipping of many tests, and make mergeVars more flexible.
This commit is contained in:
parent
862a2bc25e
commit
6206fefcee
1 changed files with 13 additions and 4 deletions
|
@ -272,6 +272,15 @@ class Controller extends Object {
|
||||||
*/
|
*/
|
||||||
public $validationErrors = null;
|
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.
|
* 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
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -410,8 +419,8 @@ class Controller extends Object {
|
||||||
$plugin = $pluginName . '.';
|
$plugin = $pluginName . '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_subclass_of($this, 'AppController') || !empty($pluginController)) {
|
if (is_subclass_of($this, $this->_mergeParent) || !empty($pluginController)) {
|
||||||
$appVars = get_class_vars('AppController');
|
$appVars = get_class_vars($this->_mergeParent);
|
||||||
$uses = $appVars['uses'];
|
$uses = $appVars['uses'];
|
||||||
$merge = array('components', 'helpers');
|
$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->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) {
|
if ($pluginController && $pluginName != null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue