2011-01-05 7 views
0

なぜ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!'); 
     } 
    } 

} 

答えて

1

Cakeの新規インストールを確認しました。 AppModelは、すべてのページの読み込み時にafterSaveを起動しません。あなたのアプリケーションはコントローラの中のあるモデル(おそらくあなたのAppControllerはすべてのページに対して呼び出されるか、またはbeforeFiltersをチェックする)のsaveを呼ぶ必要があります。

関連する問題