By now, you should be familiar with using the Gii tool to create models for our newly created tables. Go ahead and create the models for
Events. After creating each model, there are several changes we need to make to each of them.
The first change that will need to be made to our newly created models is the automatic setting of the created and updated timestamp. In previous chapters, we modified the
beforeSave() method to do this; however, Yii provides an easier way to implement this feature that is database-agnostic and reduces the amount of code we have to add to our models. To do this, we are going to attach a behavior to each of our models.
Behaviors in Yii are objects that have methods that ...