Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.