create View instance after adding model params for request

This commit is contained in:
Ceeram 2012-02-24 18:16:53 +01:00
parent 4edb378ef8
commit 677f0708dc

View file

@ -903,15 +903,6 @@ class Controller extends Object implements CakeEventListener {
return $this->response; return $this->response;
} }
$viewClass = $this->viewClass;
if ($this->viewClass != 'View') {
list($plugin, $viewClass) = pluginSplit($viewClass, true);
$viewClass = $viewClass . 'View';
App::uses($viewClass, $plugin . 'View');
}
$View = new $viewClass($this);
if (!empty($this->uses)) { if (!empty($this->uses)) {
foreach ($this->uses as $model) { foreach ($this->uses as $model) {
list($plugin, $className) = pluginSplit($model); list($plugin, $className) = pluginSplit($model);
@ -922,6 +913,15 @@ class Controller extends Object implements CakeEventListener {
$this->request->params['models'][$this->modelClass] = array('plugin' => $this->plugin, 'className' => $this->modelClass); $this->request->params['models'][$this->modelClass] = array('plugin' => $this->plugin, 'className' => $this->modelClass);
} }
$viewClass = $this->viewClass;
if ($this->viewClass != 'View') {
list($plugin, $viewClass) = pluginSplit($viewClass, true);
$viewClass = $viewClass . 'View';
App::uses($viewClass, $plugin . 'View');
}
$View = new $viewClass($this);
$models = ClassRegistry::keys(); $models = ClassRegistry::keys();
foreach ($models as $currentModel) { foreach ($models as $currentModel) {
$currentObject = ClassRegistry::getObject($currentModel); $currentObject = ClassRegistry::getObject($currentModel);