Hi all,
This is my first post on the forums, but I've reading it for a while, but didn't register until now.
I've recently picked up a mature project built in zend framework 1.10 which I'm pretty much maintaining it, I'm still getting used to the code base, but to be honest it's really confusing.
Anyway, I've noticed that the responsibility delegation between controllers and views on the project is really weird:
The project tree is something like:
As you can see on the structure above, there's a separate location, outside application, where "Layouts" (which look like what a view really is) are stored, not all actions of a controller have a "View" file in the Views folder inside application, and even there are some controllers that doesn't have a "View" at all but have a "Layout". In the case when there are both a "View" and a "Layout". These "Views" generally have a __construct or a 'loadData' method that does a lot of interaction with models (mostly getting stuff) and assigning what they retrieve from the models to the layout... in this sense they are doing controller stuff and in these cases the controller are mostly empty, why is it that the Views are getting information from the models? is this a valid practice for a Zend Framework project? the logic flow looks like thisapplication
-- Controllers-- HomeController.php-- UserController.php-- Models-- User.php-- Views-- Userhtml-- Detail.php
-- Edit.php
-- helpers
-- filters
-- layouts
-- scripts-- home-- index.phtml-- user-- edit.phtml
-- details.phtml
Controller -> Model -> View -> Model -> Layout
I do not understand the role of these so called "Views" that do controller stuff, so probably I'm missing something or probably this is a valid approach?
Any insight is truly welcome,
Thanks.