簡體   English   中英

如何使用具有多對多關系的Zend_Db_Table

[英]How to use Zend_Db_Table with many to many relationships

如何將Zend的Zend_Db_Table與聯結表建立多對多關系 有沒有提供這種虛構性的內置方法,或者必須編寫簡單的SQL?

在文檔中: 通過多對多關系獲取行集

要獲取一行:

$row->findManyToManyRowset($table,
                           $intersectionTable,
                           [$rule1,
                               [$rule2,
                                   [Zend_Db_Table_Select $select]
                               ]
                           ]);
// Example
$productsRowset = $bug1234->findManyToManyRowset('Products',
                                                 'BugsProducts');
// Here, BugsProducts is the junction table

但是,對於一對多關系,您還需要在類中定義該關系: 定義關系

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM