Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter V3
#11

[eluser]ColonelChlorine[/eluser]
Hey Phil, as an idea ... why not provide a boolean parameter to the load method which declares whether or not to instantiate the class?

This way the file will be required (once), but the class not instantiated ... thereby getting rid of some of the singleton problems.

For example I would make a model called, "Company" which doesn't extend CI_Model, but has it's own internal access to CI via =& get_instance(). That way I could do something like:

Code:
$this->load->model('Company', false);
$company1 = new Company();
$company2 = new Company();
$company1->add_partner($company2);
$company1->save();

Does that make sense?


Messages In This Thread
CodeIgniter V3 - by El Forum - 01-02-2012, 05:56 AM
CodeIgniter V3 - by El Forum - 01-19-2012, 08:54 PM
CodeIgniter V3 - by El Forum - 01-19-2012, 10:17 PM
CodeIgniter V3 - by El Forum - 01-19-2012, 11:36 PM
CodeIgniter V3 - by El Forum - 01-20-2012, 12:06 AM
CodeIgniter V3 - by El Forum - 01-20-2012, 02:37 AM
CodeIgniter V3 - by El Forum - 01-21-2012, 12:44 PM
CodeIgniter V3 - by El Forum - 01-21-2012, 02:04 PM
CodeIgniter V3 - by El Forum - 01-21-2012, 04:17 PM
CodeIgniter V3 - by El Forum - 01-21-2012, 10:56 PM
CodeIgniter V3 - by El Forum - 02-21-2012, 10:36 AM
CodeIgniter V3 - by El Forum - 02-21-2012, 03:06 PM
CodeIgniter V3 - by El Forum - 02-21-2012, 03:27 PM
CodeIgniter V3 - by El Forum - 02-21-2012, 03:29 PM
CodeIgniter V3 - by El Forum - 02-21-2012, 03:35 PM
CodeIgniter V3 - by El Forum - 02-21-2012, 03:59 PM
CodeIgniter V3 - by El Forum - 02-28-2012, 11:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB