O'Reilly logo

Mastering Yii by Charles R. Portwood II

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Migrations, DAO, and Query Building

One of the most fundamental aspects of writing modern web application is working with databases. Through PHP's PDO driver, Yii2, can work with many different kinds of relational databases. In this chapter, we'll cover how to connect to different databases, write database migrations to instantiate our databases, use database access objects (DAO), and use Yii2's built-in Query Builder. We'll also cover the basics of powerful tools such as data providers and data widgets as well as how to use Yii2 to replicate and load balance access to our databases.

Connecting to databases

The primary component required in order to work with databases is the yii\db\Connection class. Through this class, we can connect ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required