i know that everything is going through the controller.
but i often read articles that says something like this:
i dont get the 3rd one. why saying that the model notifies the view, when it actually is notifying the controller and the controller is notifying the view?
That seems more like a desktop system and not a stateless system like a website.
But maybe it's talking about how some people like to query the models from the view e.g.
<?php foreach( $usersTableGateway->getUsers() as $user ): ?>
<?php echo $user ?><br>
<?php endforeach; ?>
I'm more of a fan of getting all the info in the controller (preparing the users array in the controller) and passing it to the view from the controller.
MVC is a broad concept, and there are a wide variety of possible implementations. For example, Page Controller separates logic from the view, and so does Front Fontroller. Each MVC framework also has different methods for rendering model data in the view - Zend uses Two-Step for example.
You could possibly set up an Observer relationship between a view object and "the Model" (which in itself is a really complicated beast) but I think this aspect of the MVC pattern is more to do with the original context of the pattern - i.e. Galen's point above
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With