How can I use Zend's Zend_Db_Table with many to many relationships with a junction table? Is there any built in method providing this fictionality or have to write simple SQL?
It's in the documentation: Fetching a Rowset via a Many-to-many Relationship
To fetch a row:
$row->findManyToManyRowset($table,
$intersectionTable,
[$rule1,
[$rule2,
[Zend_Db_Table_Select $select]
]
]);
// Example
$productsRowset = $bug1234->findManyToManyRowset('Products',
'BugsProducts');
// Here, BugsProducts is the junction table
But, as for a one-to-many relationship, you need to also define the relation in the classes: Defining relationships .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.