Fixes on load_model
This commit is contained in:
parent
1d19037145
commit
d03e7e1bf1
1 changed files with 16 additions and 29 deletions
|
|
@ -76,6 +76,12 @@ class Webmodel {
|
||||||
|
|
||||||
static public $prefix_db='';
|
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.
|
* 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.
|
* Method for load models from a project.
|
||||||
*
|
*
|
||||||
|
|
@ -290,32 +285,24 @@ class Webmodel {
|
||||||
|
|
||||||
$path_model=Webmodel::$model_path.$app_model.'/'.Webmodel::$model_folder.'/models_'.$model.'.php';
|
$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);
|
if(is_file($path_model))
|
||||||
|
|
||||||
/*$func_load=$model.'ModelLoad';
|
|
||||||
|
|
||||||
if(!function_exists($func_load))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
throw new \Exception('Error: function '.$func_load.' not found in '.$path_model);
|
include($path_model);
|
||||||
|
|
||||||
|
Webmodel::$cache_model[$app_model.'/'.$model]=1;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue