Hello all
IsZend_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开发者_JAVA技巧_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
Found a solution:
$a = new News();
$a->fetchRow()->findParentRegions($a->select()->where('region_enabled = ?', 1));
精彩评论