Symfony1 覆盖管理生成器模块中的executeCreate操作

Symfony1 覆盖管理生成器模块中的executeCreate操作,symfony1,admin-generator,Symfony1,Admin Generator,我正在工作的当前项目的一个功能是发送电子邮件通知,其中包含有关最近创建的对象的一些信息 以下是我当前操作代码的代码: public function executeCreate(sfWebRequest $request) { try { parent::executeCreate($request); } catch (sfStopException $e) { $this->notifyAdmin($request); throw new s

我正在工作的当前项目的一个功能是发送电子邮件通知,其中包含有关最近创建的对象的一些信息

以下是我当前操作代码的代码:

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

   throw new sfStopException();
  }
 }

在过去,以前的代码已经可以很好地工作了,但现在不行了。我不太明白可能的原因,一旦项目被使用,它被连接到symfony发布标签(1_4_4),我假设没有进行任何更改。现在,catch块的代码永远不会执行。

您发布的代码仅在创建过程失败时发送通知

要每次通知管理员,请将通知移到create调用下方

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

我已经测试了你提出的解决方案。位于父方法调用下面的所有指令都不会执行。