If you have a one-to-many
relationship with the categories (it appears you do), you can join the
category table in your select query to return all the data you need in
one shot.
<?php
$jobs = new Jobs(); // jobs table
$categories = new Categories(); // categories table
$select = $jobs->select()
->join($categories, 'jobs.category_id = categories.id');
$rows = $jobs->fetchAll($select); // returns rowset of jobs with
category info
?>
-Hector
Ralf Eggert wrote:
Hi,
I am currently using the Zend_Db_Table Relationships and all works very
nice. But there is one thing I am really missing.
With fetchAll I am reading a list of jobs from the database. Each job
has an category_id which is referenced to a category table. When I want
to output the list of jobs, I need to use findParentGroup() for each row
of the rowset which is a really pain, when outputing 50 rows.
How do others handle this problem? Is there an easy way how to amend
Zend_Db_Table or Zend_Db_Table_Rowset to get the related data for each
Zend_Db_Table_Row object?
Thanks in advance for any advise.
Best regards,
Ralf