-
Book Overview & Buying
-
Table Of Contents
Yii Application Development Cookbook - Second Edition - Second Edition
Most applications today use databases. Be it a small website or a social network, at least some parts are powered by databases. Yii introduces three ways that allow you to work with databases:
Active Record
Query builder
SQL via DAO
We will use all these methods to get data from the film, film_actor, and actor tables and show it in a list. We will measure the execution time and memory usage to determine when to use these methods.
Create a new application by using yiic webapp as described in the official guide at the following URL:
http://www.yiiframework.com/doc/guide/en/quickstart.first-app
Download the Sakila database from the following URL:
Execute the downloaded SQLs; first schema then data.
Configure the DB connection in protected/config/main.php to use the Sakila database.
Use Gii to create models for the actor and film tables.
We will create protected/controllers/DbController.php as follows...
Change the font size
Change margin width
Change background colour