Fixes on load_model

This commit is contained in:
Antonio de la Rosa 2015-05-10 15:24:36 +02:00
parent 1d19037145
commit d03e7e1bf1

View file

@ -76,6 +76,12 @@ class Webmodel {
static public $prefix_db='';
/**
* Array for check if a model was loaded.
*/
static public $cache_model=array();
/**
*
* With this property, you can define what is the server connection that you have to use for read the source data.
@ -254,17 +260,6 @@ class Webmodel {
}
/**
* Method for load config from a project.
*/
static public function load_config()
{
//if(is_file($this->path_mo
}
/**
* Method for load models from a project.
*
@ -290,31 +285,23 @@ class Webmodel {
$path_model=Webmodel::$model_path.$app_model.'/'.Webmodel::$model_folder.'/models_'.$model.'.php';
if(is_file($path_model))
if(!isset(Webmodel::$cache_model[$app_model.'/'.$model]))
{
include($path_model);
/*$func_load=$model.'ModelLoad';
if(!function_exists($func_load))
if(is_file($path_model))
{
throw new \Exception('Error: function '.$func_load.' not found in '.$path_model);
include($path_model);
Webmodel::$cache_model[$app_model.'/'.$model]=1;
}
else
{
return $func_load();
throw new \Exception('Error: model not found in '.$path_model);
}*/
}
else
{
throw new \Exception('Error: model not found in '.$path_model);
}
}