model

From SkyPHP

Jump to: navigation, search

The aql class uses models to make database interaction more convenient.

Contents

Parts of a model

Each model has the following parts:

What is a model used for?

  1. Select data from the database [see aql::select()]
  2. Display an html data grid [see aql::grid()]
  3. Easily build listing pages and profile pages (Content Management System)
  4. Save data to multiple tables and automatically save foreign key references [see aql::save()]

Example model folder

Let's take a look at the "person" model. Normally, you should name our model the same as its primary table.

Notes

If you join a second table to the primary table in the model, do not name the model with both table names.

Example:
We have a model named client_person because there is a table with that name.
But if you were to simply join the person table to the client table, still use the primary table (client in this case) as the name for the model.

Personal tools