Welcome Guest, Not a member yet? Register   Sign In
extending a model with another one?
#1

[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')?
#2

[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');
$this->load->library('notImportantAn',$params);




Theme © iAndrew 2016 - Forum software by © MyBB