Book Image

Yii Project Blueprints

By : Charles R. Portwood ll
Book Image

Yii Project Blueprints

By: Charles R. Portwood ll

Overview of this book

Table of Contents (15 chapters)
Yii Project Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring the skeleton project


There are actually a lot of different things going on in the background to make this work even if this is just a 404 error. Before we start doing any development, let's take a look at a few of the classes that have been provided in our skeleton project in the protected/components folder.

Extending models from a common class

The first class that has been provided to us is an ActiveRecord extension called CMSActiveRecord that all of our models will stem from. This class allows us to reduce the amount of code that we have to write in each class. For now, we'll simply add CTimestampBehavior and the afterFind() method we've used in previous chapters to store the old attributes for the time the need arises to compare the changed attributes with the new attributes:

class CMSActiveRecordCMSActiveRecord extends CActiveRecord
{
   public $_oldAttributes = array();

   public function behaviors()
   {
      return array(
         'CTimestampBehavior' => array(
      ...