Prev | Current Page 153 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

The model is usually a set of classes that build off of Zend_Db_Table_Abtract and
Zend_Db_Table_Row_Abtract. Within the Places application we use a model to represent the registered users
of the website. The database table required is quite simple and is shown in Figure 5.2.
Figure 5.2. The Users table for Places contains login information along with demographic information for advertisers.
As we want to make money from Places, we expect that advertisers will want to know the demographics
of the membership, so we would like our members to tell us their age, sex and location. Of course, this would
be optional, whereas the username and password are mandatory.
We will need to access our database tables at two different levels: table and row. The table level is used
when we need to display lists and the row level is used when dealing with individual records. In order to deal
with this in the code, we need two classes, Users and User which are extensions of Zend_Db_Table_Abstract
and Zend_Db_Table_Rowset respectively. The class definitions are shown in Listing 5.7. Note that in usually
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
you would use two files: User.


Pages:
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
Wczasy nad morzem kasyno kino azjatyckie bwin out of home advertising