Chapter 6. Managing the database

 

This chapter covers

  • The use of Zend_Db to query databases directly
  • An introduction to the Table Data Gateway pattern with Zend_Db_Table
  • Unit-testing database operations
  • Relationships between database tables

For most websites, a database is a vital part of their applications. Zend Framework acknowledges this with a comprehensive set of database-related components that provide varying levels of abstraction.

Two important levels of abstraction are databases and tables. The database abstraction keeps your PHP code independent from the underlying database server you use. This means that it is easier for your application to support multiple database servers. Table abstraction represents the database tables and rows as PHP objects. This allows the rest of your application to interact with PHP without knowing that there is an underlying database.

We’ll start by looking at the Zend_Db_Adapter class, which provides a product-independent interface to the database server.

6.1. Database Abstraction with Zend_Db_Adapter

 
 
 

6.2. Table Abstraction with Zend_Db_Table

 
 
 

6.3. Using Zend_Db_Table as a Model

 
 
 
 

6.4. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest