0

私はsymfonyadminジェネレーターを使用して、アスリート管理用の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がPOSTの場合にのみ、重複するアスリート番号を確認したいのですが、そうではないようです。どのタイプがHTTPリクエストであるかを確認するために、すでにいくつかの例外を出力に送信しましたが、常にGETであるようです。

4

1 に答える 1

2

[編集]ページで[保存]をクリックすると、情報が編集アクションに投稿されず、更新と呼ばれるアクションに投稿されるという問題が発生します。

キャッシュ内のactions.class.phpファイルを見ると、それが表示されます。

于 2010-06-24T10:06:32.137 に答える