I'm new to HMVC and whilst tutorials are great about dealing with the overall details of keeping modules separate and only letting controllers communicate, they aren't so great at explaining the little details of what should go where.
This is an example I'm currently faced with. I'm using Kohana as my framework, and building an admin control panel for a website. The first thing I've done is to set up the page. All admin pages are in the Admin controller, with each page being an action. That's all fine and I've created a basic login page based off Kohana's Auth system.
Now I'm coming to my first proper page, the accounts page. It needs to list all accounts with links to create new ones and edit / delete existing ones. Fairly straight forward, I have a view for the page, and then create a new module for an account. But then here's where the tutorials let me down, when I need to fetch a list of all accounts. By design the new module should be a single instance of an account, so when I'm loading all accounts I'll end up with an array of instances, one for each account. But where is this array? Do I create a factory that controls this and if so, where does the factory sit in the HMVC structure?
Assuming that's resolved and I have my array of accounts available to the page controller, what about if when loading these accounts I need to filter them? Most pages listing accounts or products or anything like that will have a search at the top. Now the search is part of the page, so it should belong to the admin controller, right? So how do I get that information to the accounts model when it's loading all those accounts?
Before HMVC I would have just written the where clause of the query in the admin controller and passed that to the accounts model, but that's not an option in HMVC as the admin controller shouldn't have any knowledge of the structure of accounts. So now do I just pass the search results as variables into the accounts controller? Does the accounts controller just load this information directly from GET/POST (even though the search belongs to the admin controller)? What is the recognised way to handle this in HMVC?
I've tagged this PHP because that's what I'm using, and I'd appreciate any examples to be in PHP.