title: Zend Framework model with service
body: <p>i have a question about Zend Framework and mainly the model part. I know there is no abstract model class and understand why. I red a lot of blog posts about it, but couldn't find any example that would clearly explain it to me. I'm building a very basic application. Lets imagine we have just three tables. company(ID, name, street, streetNo, Town), meta(ID, name, description), company2meta(ID, companyID, metaID, value, note). All types of realtionship are there (1n n1, nm). The a need also services (amf) with Value Objects. So, here is what I think:</p>
  
  <ol>
  <li><p>I would create three table classes under /model/dbTables/(Company.php, Meta.php, Company2Meta.php).</p></li>
  <li><p>Then in models/, I would add User.php (basic class), which should has methods such saveCompany..., deleteCompany, getCompanyMeta..., and operates above selected tables.</p></li>
  <li><p>The service class (/services/CompanyService.php), would create instance of the model in constructor and has same methods as model.</p></li>
  </ol>
  
  <p>And here is my question. How should data flow and what should be done where? For example when i call getCompany in service clas i want it to return value object, which contains all info about company and about its metas. if there wouldnt be the model class a could just get row form company and rowset from mate2company and transform it to value object, and when i want to update it i need to save info about company and also all its metas (need to find new ones (insert), old (update) and delete the deleted...) So where should this be done? in model or in service? I hope you can understend what i am asking.</p>
  
  <p>ps: sorry for my english...</p>