title: Should dependent rows be fetched in the Model or the Controller?
body: <p>Let me start with a simple example to show how my data is structured. There are four tables, <code>Employee</code>, <code>Store</code>, <code>Department</code>, and <code>Employee_Department_Permissions</code>. </p>
  
  <p>Departments belong to Stores (for example, the Department table might contain a record for the dairy department of store 5). Employees are given the right to work in Departments through the Employee_Department_Permissions table, which contains the Employee id and Department id.</p>
  
  <p>Let's say an employee can log in to my application and view a list of every store in the database. Next to each store, I want to print out how many departments they can work in at each store. I have an Employee model with a mapper that provides the <code>fetchAll</code> method to accomplish the first part. </p>
  
  <p>But, where should I find out how many departments an employee can work in? In my model wrapper, I can call <code>findDependentRows</code> to do this. Or, I could do it in my controller with raw <code>Zend_Db_Select</code> calls. A third option I was considering would to be just add a column to the Employee table that holds this information, but then I'd need to update a second table when Employee_Department_Permission is modified. </p>
  
  <p>Thank you in advance for any advice.</p>