所有網頁 圖片 影片 地圖 新聞 網誌搜尋 Gmail 更多 »
最近造訪的群組 | 說明 | 登入
Google 網上論壇首頁
Write to log table for every successful update/delete
目前本群組有太多主題設為優先顯示。要優先顯示這個主題,請將其他主題的這個選項取消。
在處理您的要求時發生錯誤。請再試一次。
標幟
  9 個訊息 - 全部摺疊  -  將全文翻譯為 已翻譯 (查看所有原文)
您要留言的群組是 Usenet 群組。在此群組留言,網際網路上的任何使用者將可以看到您的電郵地址。
您的回覆郵件尚未寄出。
您已成功留言
 
寄件人:
收件人:
副本:
後續追蹤對象:
新增副本 | 新增後續追蹤對象 | 編輯主旨
主旨:
驗證:
為了確認,請輸入您在以下圖片中看到的字元,或輸入您按下存取圖示時所聽到的號碼。 注意聽並輸入您聽到的號碼
 
satyavirya  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 上午12時18分
寄件人: satyavirya <hendry....@gmail.com>
日期: Fri, 3 Jul 2009 09:18:23 -0700 (PDT)
當地時間: 2009年7月4日(星期六) 上午12時18分
主旨: Write to log table for every successful update/delete
Hi guys, my app need to write into a log table for every successful
update/delete operation, my current approach is to put the code in
AfterFilter in AppController, the problem is, how do I get / know a
successful update/delete has been done?
Or is there any other suggestions to do this? Thanks.

    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Carlos Gonzalez Lavin  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 上午12時47分
寄件人: Carlos Gonzalez Lavin <carloslavi...@gmail.com>
日期: Fri, 3 Jul 2009 11:47:20 -0500
當地時間: 2009年7月4日(星期六) 上午12時47分
主旨: Re: Write to log table for every successful update/delete

I don't know if these applies to you... but saves (I don't know if just
valid ones) do a callback to the model's aftersave function (either inserts
or updates)

A bit more info on it:
http://book.cakephp.org/view/684/afterSave

2009/7/3 satyavirya <hendry....@gmail.com>


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Hendry  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 上午12時58分
寄件人: Hendry <hendry....@gmail.com>
日期: Sat, 4 Jul 2009 00:58:15 +0800
當地時間: 2009年7月4日(星期六) 上午12時58分
主旨: Re: Write to log table for every successful update/delete
Hi Carlos,

Yes, I can use the model's callback method (aftersave and afterdelete)
but then, since this would require writing to another table, which
means call to other model from inside a model, wouldn't this break the
MVC pattern?

Regards,
Hendry

On Sat, Jul 4, 2009 at 12:47 AM, Carlos Gonzalez


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Braindead  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 上午5時44分
寄件人: Braindead <markus.he...@gmail.com>
日期: Fri, 3 Jul 2009 14:44:15 -0700 (PDT)
當地時間: 2009年7月4日(星期六) 上午5時44分
主旨: Re: Write to log table for every successful update/delete
You should write a behavior. I guess that's the way to go. :-)

    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Miles J  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 上午5時48分
寄件人: Miles J <mileswjohn...@gmail.com>
日期: Fri, 3 Jul 2009 14:48:20 -0700 (PDT)
當地時間: 2009年7月4日(星期六) 上午5時48分
主旨: Re: Write to log table for every successful update/delete
Why?

If anything log to text files.


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
BlueC  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 上午6時25分
寄件人: BlueC <messageforch...@googlemail.com>
日期: Fri, 3 Jul 2009 15:25:38 -0700 (PDT)
當地時間: 2009年7月4日(星期六) 上午6時25分
主旨: Re: Write to log table for every successful update/delete
You could use the logablebehavior I have used it and it is really
excellent!! It even integrates with auth component so you can log and
see who did what. It can also log inserts too.

http://code.google.com/p/alkemann/wiki/LogableBehavior
http://bakery.cakephp.org/articles/view/logablebehavior

Enjoy!

Chris

On Jul 3, 5:18 pm, satyavirya <hendry....@gmail.com> wrote:


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Paul  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 下午12時20分
寄件人: "Paul" <s...@webprogression.co.nz>
日期: Sat, 4 Jul 2009 16:20:59 +1200
當地時間: 2009年7月4日(星期六) 下午12時20分
主旨: RE: Write to log table for every successful update/delete


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Paul  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月4日, 下午12時31分
寄件人: "Paul" <s...@webprogression.co.nz>
日期: Sat, 4 Jul 2009 16:31:04 +1200
當地時間: 2009年7月4日(星期六) 下午12時31分
主旨: RE: Write to log table for every successful update/delete
Aplogies gain for the double post, email issues.

Anyway... we do a lot of logging of record creation etc to the db for
various reasons and ideally a behavior is what your after, but for a quick
solution its easy enough to call the log model on the fly in your  model
callbacks like

function afterSave($created) {
        $action = $created ? 'create' : 'update';
        $Log =& ClassRegistry::init('Log');
        $Log->create();      
        $Log->save(array('action' => $action, 'model' => $this->name,
'foreignKey' => $this->id));

}

That's a pretty crude example but nothing wrong with doing it that way if it
fits your needs. If you were to be doing this in your app model to trigger
on all models, be sure to stop the callback on your log model save,
otherwise it will eternally log it self to death.

$Log->save(array('action' => $action, 'model' => $this->name, 'foreignKey'
=> $this->id), array('callbacks' => false));

HTH

Paul


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Hendry  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 7月5日, 上午3時49分
寄件人: Hendry <hendry....@gmail.com>
日期: Sun, 5 Jul 2009 03:49:08 +0800
當地時間: 2009年7月5日(星期日) 上午3時49分
主旨: Re: Write to log table for every successful update/delete
THanks Chris, I'm testing it now ;)

Regards,
Hendry


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
無其他留言
« 返回討論主題 « 較新的主題     較舊的主題 »

Google 網上論壇 - Google 首頁 - 服務條款 - 隱私權政策
©2009 Google