I am new to HMVC and while tutorials are nice about coping with the general particulars of retaining modules separate and solely letting controllers talk, they are not so nice at explaining the little particulars of what ought to go the place.
That is an instance I am presently confronted with. I am utilizing Kohana as my framework, and constructing an admin management panel for an internet site. The very first thing I’ve finished is to arrange the web page. All admin pages are within the Admin controller, with every web page being an motion. That is all tremendous and I’ve created a primary login web page based mostly off Kohana’s Auth system.
Now I am coming to my first correct web page, the accounts web page. It must record all accounts with hyperlinks to create new ones and edit / delete current ones. Pretty straight ahead, I’ve a view for the web page, after which create a brand new module for an account. However then this is the place the tutorials let me down, once I have to fetch an inventory of all accounts. By design the brand new module ought to be a single occasion of an account, so once I’m loading all accounts I will find yourself with an array of cases, one for every account. However the place is that this array? Do I create a manufacturing unit that controls this and in that case, the place does the manufacturing unit sit within the HMVC construction?
Assuming that is resolved and I’ve my array of accounts accessible to the web page controller, what about if when loading these accounts I have to filter them? Most pages itemizing accounts or merchandise or something like that may have a search on the prime. Now the search is a part of the web page, so it ought to belong to the admin controller, proper? So how do I get that info to the accounts mannequin when it is loading all these accounts?
Earlier than HMVC I’d have simply written the the place clause of the question within the admin controller and handed that to the accounts mannequin, however that is not an choice in HMVC because the admin controller should have no data of the construction of accounts. So now do I simply cross the search outcomes as variables into the accounts controller? Does the accounts controller simply load this info instantly from GET/POST (although the search belongs to the admin controller)? What’s the recognised solution to deal with this in HMVC?
I’ve tagged this PHP as a result of that is what I am utilizing, and I would respect any examples to be in PHP.