Prev | Current Page 169 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

We then use the columns key to in each map
element to tell Zend_Db_Table the field name of the correct foreign key in the reviews table.
Selecting the list of places that have been reviewed by a given user is done using
findManyToManyRowset() again, but this time we pass in the name of the rule we want to use:
// find all places that John Smith has approved a review of.
$johnSmith = $users->fetchRow('id = 4');
$places = $johnSmith->findManyToManyRowset('Places', 'Reviews', 'ApprovedBy');
The Zend_Db_Table??™s handling of one-to-many and many-to-many relationships is surprisingly powerful,
although requiring manual setting up of the relationships in the intersection class. We will now look at how we
insert and update records using a Zend_Db_Table.
5.4 Summary
Throughout this chapter we have looked at the support for databases provided by the Zend Framework. As
nearly all web applications use databases to store there data, it comes as no surprise to find that rich database
support is provided. The foundation is the database abstraction layer, Zend_Db_Abstract, that takes care of the
nitty-gritty of dealing with the differences between specific database engines and so provides a standardized
interface for the rest of the components in the Framework.


Pages:
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
tłumacz niemieckiego hosting zakłady bukmacherskie serwis drukarek katowice petrozawodzkich.waw.pl