From 567ac0209c5b2c75c5b26cb413b95a9320aba0c3 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Wed, 13 Jul 2011 23:47:45 -0430 Subject: [PATCH] Refactoring how models are passed as a request parameter to the view, now the full plugin and model name will be passed on --- lib/Cake/Controller/Controller.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 1ba122ef716..b9436174215 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -808,8 +808,8 @@ public function render($view = null, $layout = null) { if (!empty($this->uses)) { foreach ($this->uses as $model) { - list($plugin, $model) = pluginSplit($model); - $this->request->params['models'][$model] = $plugin; + list($plugin, $className) = pluginSplit($model); + $this->request->params['models'][$model] = compact('plugin', 'className'); } } @@ -817,10 +817,10 @@ public function render($view = null, $layout = null) { foreach ($models as $currentModel) { $currentObject = ClassRegistry::getObject($currentModel); if (is_a($currentObject, 'Model')) { - list($plugin, $package) = pluginSplit(App::location(get_class($currentObject))); - $this->request->params['models'][$currentObject->alias] = $plugin; - $View->validationErrors[$currentObject->alias] =& - $currentObject->validationErrors; + $className = get_class($currentObject); + list($plugin, $package) = pluginSplit(App::location($className)); + $this->request->params['models'][$currentObject->alias] = compact('plugin', 'className'); + $View->validationErrors[$currentObject->alias] =& $currentObject->validationErrors; } }