Results 1 to 24 of 24
Jan 4, 2007, 08:36 #1
- Join Date
- Jul 2006
- 0 Post(s)
- 0 Thread(s)
A question about the model (in MVC)
In MVC (although I guess this doesn’t just apply to MVC) should my model classes/objects represent an entire database table, or an individual record in that table?
For example, I have a table called “user”, and at the moment I have a class called “UserModel”, which extends the “Model” class. I guess it’s possible to manipulate the entire table and the individual records in one class, but something like this just doesn’t seem to make much sense in my mind:
$user = new UserModel();
$user->username = 'test';
$user->password = 'password';
$user->save(); // this would save those values as a new record
$jack = $user->findAll("username = 'jack'");
Any comments would be greatly appreciated.