Creating DAO with Zend_Db_Table

intro
This article illustrates how to create DAO with Zend_Db_Table. This simplifies the action method of controller, so you can easily read and maintain the source code. You can download the source code of this article from here.

1.Create bootstrap.php and config.ini
Create the file application/bootstrap.php with the following content.

Create the file application/config.ini with the following content.
Please modify database.params.* properly.

In this article, we will use the following sql.
2.Create DAO with Zend_Db_Table
Create the file application/models/Profiles.php with the following content.
3.Create Controller
Create the file application/constorllers/IndexController.php with the following content.
4.Create View
Create the file application/views/scripts/index/index.phtml with the following content.
5.Check
Let’s access the Web Server and check the screen.

References
The following is about implementing the method findBy{field} using magic method.(Only Japanese, but maybe you can read the source code…)

Leave a Reply

Your email address will not be published. Required fields are marked *