Welcome Guest, Not a member yet? Register   Sign In
Can a model be more than just a database layer?
#1

[eluser]juddmuir[/eluser]
I've hit a problem using models and attempting to update the database.

If your model is more than just a representation of a database table, then you may have variables in your model that do not exist in the database. So when you come to e.g. update the database using

function update_entry()
{
$this->db->update('entries', $this, array('id' => $this->id));
}

an error is generated if you have a variable that doesn't map to a field. Is the solution to generate TWO objects: one that is the model that you're using, and the other that is the data-model to pass to the db->update function?


Messages In This Thread
Can a model be more than just a database layer? - by El Forum - 01-23-2009, 01:43 PM
Can a model be more than just a database layer? - by El Forum - 01-23-2009, 01:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB