/**
* Implementando loadModel dentro da ApiHelper
*/
public function _loadModel_($modelClass = null)
{
if ($modelClass === null) {
$modelClass = $this->modelClass;
}
$this->uses = ($this->uses) ? (array) $this->uses : array();
if (!in_array($modelClass, $this->uses, true)) {
$this->uses[] = $modelClass;
}
list($plugin, $modelClass) = pluginSplit($modelClass, true);
$this->{$modelClass} = ClassRegistry::init(array(
'class' => $plugin . $modelClass, 'alias' => $modelClass
));
if (!$this->{$modelClass}) {
throw new MissingModelException($modelClass);
}
return true;
}