Skip to content

Instantly share code, notes, and snippets.

@k1LoW
Created June 15, 2010 06:49
Show Gist options
  • Save k1LoW/438779 to your computer and use it in GitHub Desktop.
Save k1LoW/438779 to your computer and use it in GitHub Desktop.
if ( $controllerHasModel ) {
$model = property_exists($c->{$controllerModel}, $modelName) ? $c->{$controllerModel}->{$modelName} : $c->{$modelName};
if (get_class($model) == 'AppModel') {
if (!class_exists($modelName)) {
App::import('Model', $modelName);
}
if (!class_exists($modelName)) {
return false;
}
$model = new $modelName();
}
} else {
if (!class_exists($modelName)) {
App::import('Model', $modelName);
}
if (!class_exists($modelName)) {
return false;
} else {
$model = new $modelName();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment