$this->modelClass needs to be correct prior to the components init() call if the component itself accesses the model, lazyloading would try to load the wrong model otherwise

This commit is contained in:
euromark 2013-05-14 10:17:57 +02:00
parent f7d106a386
commit 0822578813

View file

@ -632,11 +632,11 @@ class Controller extends Object implements CakeEventListener {
*/ */
public function constructClasses() { public function constructClasses() {
$this->_mergeControllerVars(); $this->_mergeControllerVars();
$this->Components->init($this);
if ($this->uses) { if ($this->uses) {
$this->uses = (array)$this->uses; $this->uses = (array)$this->uses;
list(, $this->modelClass) = pluginSplit(current($this->uses)); list(, $this->modelClass) = pluginSplit(current($this->uses));
} }
$this->Components->init($this);
return true; return true;
} }