Thank you. What confuses me is that these methods, I can only call them on a fetched row (Zend_Db_Table_Row_Abstract).
But I want to send to my view all my articles with all their pictures. If I use these methods, I have to fetch in my controller all the articles and set them as a view variable. Then in the view, use these methods for each row (for each article, get the related pictures by doing the queries with the methods). Which I think is not respecting the MVC pattern (no business logic in the view). redphantm wrote: > > Check out this thread > <http://www.nabble.com/Saving-Related-Model-Data-tf4539948s16154.html#a12957145>. > Also read > <http://framework.zend.com/manual/en/zend.db.table.relationships.html> in > the manual. These should be enough to provide you with an example on how > to do your methods. > > debussy007 wrote: >> >> Hello. >> >> In my DB I have a table "articles" and a table "pictures" and one article >> can have one or more pictures. >> >> I want to display the list of the articles and their photos. >> But in my controller I can retrieve the list of the articles but how do I >> associate the list of pictures for each article ? >> I want to avoid having sql operations in the view to retrieve for each >> article the photos, is his possible ? >> >> If I think 'Object Oriented', I should send to the view a list of >> Articles containing each all the details from the database of the Article >> AND a list of Pictures. >> >> This is how I retrieve the articles : >> $this->view->myArticles = $articles->fetchAll($where); >> >> This gives me the Articles objects. How do I associate the photos ? >> >> Maybe there is better way also ? >> >> Thank you for any kind help !! >> > > -- View this message in context: http://www.nabble.com/Database---relations-tf4577387s16154.html#a13067071 Sent from the Zend Framework mailing list archive at Nabble.com.
