2010-11-11 34 views
0

我工作的當前項目的一個功能是發送電子郵件通知,其中包含有關最近創建的對象的一些信息。覆蓋管理生成器模塊中的executeCreate操作

這是我目前的行動代碼代碼:

public function executeCreate(sfWebRequest $request) 
{ 
    try 
    { 
    parent::executeCreate($request); 
    } 
    catch (sfStopException $e) 
    { 
    $this->notifyAdmin($request); 

    throw new sfStopException(); 
    } 
} 

在過去,前面的代碼已經工作得很好,但現在沒有。我不太明白可能的原因,一旦項目被使用,連接到symfony發行標籤(1_4_4),我假定沒有做任何更改。現在,catch塊的代碼從不執行。

回答

0

您發佈的代碼僅在創建過程失敗時發送通知。

要每次通知管理員,請將通知移動到創建調用下方。

parent::executeCreate($request); 
    $this->notifyAdmin($request); 
+0

我已經測試過您所用的解決方案。所有放在父方法調用下的指令都不會被執行。 – 2010-11-14 16:57:17