<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * 自动填充创建时间行为
 *
 * @author yzxh24
 */
class CreateAtBehavior extends CActiveRecordBehavior
{
    public function beforeValidate($on)
    {
        if ($this->Owner->isNewRecord)
        {
            $this->Owner->createdate = new CDbExpression('NOW()');
        }

        return true;
    }
}