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

Sending e-mail reminders


At this point, users can create new events and reminders for themselves through our web interface; however, they aren't able to receive these reminders yet. To send out these reminders, we'll create a new console command called RemindersCommand in protected/commands/RemindersCommand.php. When we're done, we'll be able to add this command to either our crontab or to our scheduled tasks and have it automatically process reminders in the background.

Once the RemindersCommand file has been created, create the class definition in addition to an action to send the reminders that takes a time interval as an argument. This interval will define the length of time in minutes that we should run our command for. It will find all of the reminders within that interval's timeframe to process:

class RemindersCommand extends CConsoleCommand
{
   public function actionSendReminders($interval) {}
}

Within our action, define the UNIX timestamp that we should begin at as well as the time...