The Database Abstraction Layer of Yii Framework 2.0

The Database Abstraction Layer of Yii Framework 2.0

In this talk I will introduce the database abstraction layer of Yii Framework 2.0.

I will explain the need for an abstraction layer and guide you through the class model of the implementation in Yii, where each layer builds on top of the other. Yii has three abstraction layers which are SQL Commands, QueryBuilder, and ActiveRecord.

I will show how the design of the implementation in Yii allows a lot of flexibility even on high abstraction levels. The ActiveRecord Layer even allows non-SQL database backends like Elasticsearch, MongoDB and Redis. Discussion of the ActiveRecord layer includes defining relations and reusing defined queries in different situations.

Presented on Yiiconf 2017 in Moscow.

Video is available on


Carsten Brandt

June 16, 2017