Welcome Guest, Not a member yet? Register   Sign In
Model within a model
#13

Okay. It looks like that this is not an option what I'm asking. But how about I include the model every time there is a new function inside a model? Is this oke or will it also eventually give a memory leak if there are to many?
For example like this:
PHP Code:
namespace App\Models;
use 
CodeIgniter\Model;
class 
Settings_model extends \App\Models\BaseModel {
    
    function 
tempFunction(){
        
$this->Users model('Users_model');
        
$users $this->Users->get_all_users();
    }


PHP Code:
namespace App\Models;
use 
CodeIgniter\Model;
class 
Users_model extends \App\Models\BaseModel {
    
    function 
tempFunction(){
        
$this->Settings model('Settings_model');
        
$settings $this->Settings->get_settings();
    }


I know that this means that it includes a model everytime in every function, but at least I can get the application running on CI4 and I can fix parts in the future.

By the way, why is the autoload for models from CI3 gone? I have some applications having a lot of models inside the autoload and it still runs really fast. You did not even notice it when loading it.
Reply


Messages In This Thread
Model within a model - by LuxesR - 06-29-2021, 12:31 PM
RE: Model within a model - by BilltheCat - 06-29-2021, 12:52 PM
RE: Model within a model - by LuxesR - 06-29-2021, 01:47 PM
RE: Model within a model - by BilltheCat - 06-29-2021, 02:06 PM
RE: Model within a model - by paulbalandan - 06-30-2021, 12:54 AM
RE: Model within a model - by InsiteFX - 06-30-2021, 01:58 AM
RE: Model within a model - by LuxesR - 06-30-2021, 02:49 AM
RE: Model within a model - by paulbalandan - 06-30-2021, 07:07 PM
RE: Model within a model - by LuxesR - 07-01-2021, 02:58 AM
RE: Model within a model - by paulkd - 07-01-2021, 12:36 AM
RE: Model within a model - by ikesela - 07-01-2021, 02:59 AM
RE: Model within a model - by paulbalandan - 07-01-2021, 04:25 AM
RE: Model within a model - by LuxesR - 07-01-2021, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB