
Originally Posted by
33degrees
This is a bit ambiguous, but in his code examples he passes the model object itself to the view. As far as I've seen, having the controller pass the Model to the View is the common accepted definition of the pattern
Let's say I had the following class:
Code:
class Users
{
function find_all()
{
// return database result set.
}
}
Your controller implementation would pass the Users object directly to the view:
Code:
class Controller
{
function execute()
{
$users = new Users;
$view->set('users', $users);
}
}
instead of passing the data:
Code:
class Controller
{
function execute()
{
$users = new Users;
$view->set('users', $users->find_all());
}
}
For the first approach, the view would be responsible for calling the find_all() method?
correction: had the code blocks in the wrong order. fixed.
Bookmarks