Brief introduction
The 2nd part of this series takes you deep into the Agavi world, describes how to handle user input submitted by users through Web forms, and how to support database access in your application with help from MySQL and doctrine. This section also expands your knowledge of the MVC implementation of Agavi by adding model to this mixer and using these model to read a list of vehicles from the application database.
However, knowing how to read records from a database only solves half the problem. The other half involves writing a new record or modifying an existing record, and this article addresses this issue. In the next few sections, I'll help you build a smarter web automobile Sales Platform (WASP) sample application that allows users to create, edit, and delete records through a web interface. We will also explore the basic theory of the Agavi security framework, showing how to restrict certain functionality to only authenticated users. Now, let's get started!
adding database records
First, Figure 1 will help you quickly recall the structure of this WASP database:
Figure 1. WASP Database
At the end of part 2nd of this series, a displayaction was created, which reads and displays a separate list of vehicles from the database. The manifests themselves were created manually using the original SQL command in the MySQL command prompt. However, the goal of this WASP application is to support vendors to add their own inventory to the database, which administrators can review and confirm in the database. This business objective will naturally lead to the following functional requirements:
Vendor upload the vehicle list interface;
WASP Admin to review, approve or delete upload list interface;
The security and access control models of the two types of users are differentiated.