Yii database access objects, commonly referred to as DAO, provide a powerful object-oriented API to work with a relational database. As the foundation for more complex database access, such as Query Builder and Active Record, DAO enables us to work directly with our database through SQL statements and PHP arrays. Consequently, it is significantly more performant to work with DAO statements than it is to work with either Active Record or Query Builder.
At the core of DAO is our
yii\db\Connection class, or more commonly, our
\Yii::$app->db. Since our
db component is already properly configured for SQLite, we'll use it moving forward. With DAO, there are two general types of queries that we can run: queries that ...