为什么app_model.php中的afterSave()总是会触发?

为什么app_model.php中的afterSave()总是在每个页面加载时触发?
class AppModel extends Model 
{
    public $cacheQueries = true;    
    var $actsAs = array('Containable');

    function __construct($id = false, $table = null, $ds = null) {
        parent::__construct($id, $table, $ds);
    }

    function afterSave($created) {
        // Is used for better workflow when saving data
        // Just for update
        if(!$created) {
            $_SESSION['redirect_update'] = true;
            $_SESSION['redirect_to']     = $_SESSION['form_referer'];
            debug('im always show on every page load!');
        }
    }

}
    
已邀请:
刚检查了全新安装的Cake。 AppModel不会在每个页面加载时触发
afterSave
。你的应用程序必须在你的一个控制器中的某个型号上调用
save
(可能是你的AppController,因为每个页面调用它,或者检查你的beforeFilters)。     

要回复问题请先登录注册