开发者

Zend_Db_Table "where" for relations?

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开发者_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));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜