Welcome Guest, Not a member yet? Register   Sign In
Load model with a constructer - possible?
#7

[eluser]Michael Wales[/eluser]
Yes, typically, in the past I would write a get() method for each model that accepted an array of search parameters. So, I could do things like this:

Code:
$this->load->model('user');
$u = $this->user->get(array('id'=>4));
echo $u->email;
$this->user->set_email($new_email);

Now, I do something like this (coming soon):
Code:
$this->datamapper->model('user');
$u = new User(array('id'=>4));
echo $u->email;
$u->email = $new_email;
$u->save();


Messages In This Thread
Load model with a constructer - possible? - by El Forum - 08-26-2008, 02:42 PM
Load model with a constructer - possible? - by El Forum - 08-27-2008, 01:58 PM
Load model with a constructer - possible? - by El Forum - 08-27-2008, 02:27 PM
Load model with a constructer - possible? - by El Forum - 08-27-2008, 03:08 PM
Load model with a constructer - possible? - by El Forum - 08-27-2008, 11:05 PM
Load model with a constructer - possible? - by El Forum - 08-28-2008, 08:08 AM
Load model with a constructer - possible? - by El Forum - 08-28-2008, 09:58 AM
Load model with a constructer - possible? - by El Forum - 08-28-2008, 12:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB