0

Hello all
Is Zend_Db_Table (Zend_Db_Table_*) supports where for related data that defined through $_referenceMap / $_dependentTable

As example, i have Blogs (table: blogs) and Regions (table: regions) classes, each Blog have region_id:

|-------------|              |--------------|
| regions     |              | blogs        |
|-------------| 1     :    m |--------------|
| region_id   | <----------- | region_id    |
| region_name |              | blog_id      |
|-------------|              | blog_message |
                             | blog_enabled |
                             |--------------|

And is there any way to do, something like:

$a = new Regions();
$a->fetchRow(1)->findBlogs(..., $a->getAdapter()->quoteInto('blog_enabled = ?', 1));

i.e. find Region with region_id == 1, then find all Blogs, that belongs to Region, and have blog_enabled == 1

  • If you have a Row object as the result of a query on a parent table, you can fetch rows from dependent tables that reference the current row. Use the method: $row->findDependentRowset($table, [$rule]); quoted from this page http://framework.zend.com/manual/en/zend.db.table.relationships.html – Jeff Busby Jan 14 '11 at 18:37
  • yup, but there's no way to specify `where` conds... – Bubonic Pestilence Jan 15 '11 at 10:53

1 Answers1

0

Found a solution:

$a = new News();
$a->fetchRow()->findParentRegions($a->select()->where('region_enabled = ?', 1));