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

Implementing the issue-management component


At the core of our application are the issues that users will submit. For this application, we'll assume that users will submit new issues for themselves, and that supporters will be supporting those issues. To ensure that issues are created for just the logged-in user, we have to make a few changes to our Issues model. Open protected/models/Issues.php, and let's get started.

The Issues model

Provided at the top of our skeleton model are properties designed to help us later in the model:

   private $_isNewRecord = false;
   public  $_isEmailCreate = false;

The first property $_isNewRecord is a Boolean value that we'll use within our afterSave() method to determine what e-mail will be sent. While CActiveRecord provides a property called $isNewRecord, Yii changes this value to FALSE before the afterSave() method.

The second property $_isEmailCreate is also a Boolean value. Since the e-mails we receive won't have a session associated with them, we need...