> -----Original Message----- > From: Ian Warner [mailto:[EMAIL PROTECTED] > is this correct - what are the overheads of doing this - is > it doing more queries to find the references?
Yes. It executes a separate query to get the parent row or dependent rowset for each row of the base table. > I just thought i did a query and the references create the > joins and the results are returned to me in a nice package :) No, the references do not generate queries with joins. Keep in mind that Zend_Db_Table is always an object mapping to a *single* table. It does not model joined result sets. Keep in mind that the table-relationships methods are operations in the context of a *row*, not a table. In other words, "given the current row, find for me the row to which it refers in its parent table." Once I have fetched a row from the Players table, and I want the row from the Teams table that the Player row references, it doesn't make sense to do a join of Players to Teams. Zend_Db_Table_Row uses the value of the foreign key in the Player row, and uses that value to find the appropriate row from Teams with that value in its primary key. No join is necessary, and it would be wasteful to do one. If you do want to do a join, you should write a SQL query and execute it with methods of the Zend_Db_Adapter object. Regards, Bill Karwin
