mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Refactoring how models are passed as a request parameter to the view, now the full plugin and model name will be passed on
This commit is contained in:
parent
e45b35cffe
commit
567ac0209c
1 changed files with 6 additions and 6 deletions
|
@ -808,8 +808,8 @@ class Controller extends Object {
|
||||||
|
|
||||||
if (!empty($this->uses)) {
|
if (!empty($this->uses)) {
|
||||||
foreach ($this->uses as $model) {
|
foreach ($this->uses as $model) {
|
||||||
list($plugin, $model) = pluginSplit($model);
|
list($plugin, $className) = pluginSplit($model);
|
||||||
$this->request->params['models'][$model] = $plugin;
|
$this->request->params['models'][$model] = compact('plugin', 'className');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,10 +817,10 @@ class Controller extends Object {
|
||||||
foreach ($models as $currentModel) {
|
foreach ($models as $currentModel) {
|
||||||
$currentObject = ClassRegistry::getObject($currentModel);
|
$currentObject = ClassRegistry::getObject($currentModel);
|
||||||
if (is_a($currentObject, 'Model')) {
|
if (is_a($currentObject, 'Model')) {
|
||||||
list($plugin, $package) = pluginSplit(App::location(get_class($currentObject)));
|
$className = get_class($currentObject);
|
||||||
$this->request->params['models'][$currentObject->alias] = $plugin;
|
list($plugin, $package) = pluginSplit(App::location($className));
|
||||||
$View->validationErrors[$currentObject->alias] =&
|
$this->request->params['models'][$currentObject->alias] = compact('plugin', 'className');
|
||||||
$currentObject->validationErrors;
|
$View->validationErrors[$currentObject->alias] =& $currentObject->validationErrors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue