Skip to content

Instantly share code, notes, and snippets.

@owenthereal
Forked from k1LoW/transition.php
Created June 15, 2010 06:50
Show Gist options
  • Save owenthereal/438781 to your computer and use it in GitHub Desktop.
Save owenthereal/438781 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