extending a model with another one? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: extending a model with another one? (/showthread.php?tid=17477) |
extending a model with another one? - El Forum - 04-06-2009 [eluser]Unknown[/eluser] Let's say in normal OOP code I have 3 classes: 1. class Announce 2. class importantAn extends Announce 3. class notImportantAn extends Announce I was thinking in CI I would make a model Announce that extends Model, and another model importantAn that extends Announce, but can't see how this is possible... how would I go about this? //as a side question, can I somehow use __construct for model classes to set stuff(I understand $this->load->model('x','y') acts basicly as $this->y = new X)? Or I would have to use a setter so that I could access the method $this->y->setStuff('x','y','z')? extending a model with another one? - El Forum - 04-06-2009 [eluser]Mike Ryan[/eluser] Hi, I think the answer to both your primary and side questions is: use libraries. Just create a library for each class and extend as normal. Code: $params = array('foo' => 'oof', 'bar' => 'rab'); |