管理者ジェネレーターを介して新しいレコードが作成されたときに電子メールを送信します
-
29-09-2019 - |
質問
Symfony Admin Generatorを使用して、アスリート管理のためのWebアプリケーションを作成しました。最後のクライアントの要件の1つは、ユーザーに気付く機能を追加し、データベースに同じ番号のアスリートが挿入されたときに管理者に電子メールを送信することでした。これまで、アスリートテーブルの列番号には独自の制約がありましたが、クライアントはとにかくアスリートが挿入できることを望んでいます。
それを達成するために、クライアントの要件を実装するために編集 /新しいアクションを拡張しようとしていました。
これがコードです:
public function executeEdit(sfWebRequest $request)
{
$user = $this->getUser();
if(! $user->hasCredential('admin'))
{
$clube_id = $user->getAttribute('id');
$atleta_id = $request->getParameter('id');
$atleta = Doctrine::getTable('Atleta')->find($atleta_id);
if($clube_id != $atleta->clube_id)
$this->forward404();
}
if($request->get('post'))
{
// check if the inserted athlete BI already exists; if so, display a message to the user and send an email to the system admins
$atleta_id = $request->getParameter('id');
$atletaBIExiste = Doctrine::getTable('Atleta')->findDuplicateAthleteBI($atleta_id);
if($atletaBIExiste)
{
// display a notice message to the user
$this->getUser()->setFlash('error', 'Athlete already exists');
// send an email to the system administrator
}
}
return parent::executeEdit($request);
}
私の問題は次のとおりです。編集アクションを実行するとき、HTTPが投稿されている場合にのみ、重複したアスリート番号を確認したいのですが、決してそうではないようです。私はすでに出力にいくつかの例外を送信して、どのタイプがHTTP要求であるかを確認していましたが、それは常に取得されているようです。
解決
キャッシュのAction.class.phpファイルをご覧ください。そうすれば、表示されます。
所属していません StackOverflow