Skip to content

Commit

Permalink
Refactoring how models are passed as a request parameter to the view,…
Browse files Browse the repository at this point in the history
… now the full plugin and model name will be passed on
  • Loading branch information
lorenzo committed Jul 14, 2011
1 parent e45b35c commit 567ac02
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Cake/Controller/Controller.php
Expand Up @@ -808,19 +808,19 @@ 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');
}
}

$models = ClassRegistry::keys();
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;
}
}

Expand Down

0 comments on commit 567ac02

Please sign in to comment.