1

人々が登録できるようにするフォームを作成しました。うまく機能しましたが、数週間が経過し、機能しなくなりました。

私はインデックス機能を備えたモジュールの碑文を持っています:

public function executeIndex(sfWebRequest $request)
{
    $this->form = new InscriptionForm();
}

indexSuccess.php には、次のものがあります。

<?php include_partial('form', array('form' => $form)) ?>

私の部分的な形は次のようなものです:

<form action="<?php echo url_for('Inscription/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
... // All my input for the inscription Form
</form>

そして作成機能:

public function executeCreate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod(sfRequest::POST));

    $this->form = new InscriptionForm();

    $this->processForm($request, $this->form);
  }

フォームは正しく表示されますが、フォームを送信すると、作成機能が呼び出されなくなります。

$form->getObject()->isNew() 

true を返します。

更新ケースは機能しますが、作成だけは機能しません。config -> request だけで、エラーはありません。

parameterHolder:
  action: index
  module: Inscription

私のフォームは、作成する代わりにアクション インデックスを呼び出すようです。私は今何時間も探していますが、理由がわかりません。

編集:

フォームを送信すると、次のようになりました。

options:
  path_info_key: PATH_INFO
  path_info_array: SERVER
  http_port: null
  https_port: null
  default_format: null
  logging: '1'
  relative_url_root: null
  formats: { txt: text/plain, js: [application/javascript, application/x-javascript, text/javascript], css: text/css, json: [application/json, application/x-json], xml: [text/xml, application/xml, application/x-xml], rdf: application/rdf+xml, atom: application/atom+xml }
  no_script_name: false
parameterHolder:
  action: index
  module: Inscription
  sf_guard_user: { id: '', _csrf_token: 2a4bd03a7c7cb1cfd8a41653fddabcc3, username: '', email_address: admin, password: admin, password_confirmation: '', Informations: { sexe_id: '1', date_naissance: { month: '', day: '', year: '' }, id: '', token: '0', etat_id: '2' }, Avatar: { id: '', valide: '0' } }
attributeHolder:
  sf_route: 'sfRoute Object()'

これは create 関数が呼び出されていないようなものです!

そして私のログには次のものがあります:

#   type    message
1    sfPatternRouting   Connect sfRoute "sf_guard_signin" (/guard/login)
2    sfPatternRouting   Connect sfRoute "sf_guard_signout" (/guard/logout)
3    sfPatternRouting   Match route "sf_guard_signin" (/:module) for /Inscription     with parameters array ( 'module' => 'Inscription', 'action' => 'index',)
4    sfFilterChain  Executing filter "sfRenderingFilter"
5    sfFilterChain  Executing filter "sfExecutionFilter"
6    InscriptionActions Call "InscriptionActions->executeIndex()"
7    sfPHPView  Set component "sf_twitter_bootstrap_permanent_slot" (/)
8    sfPHPView  Render "sf_app_dir\modules/Inscription/templates/indexSuccess.php"
9    sfPartialView  Render "sf_app_dir\modules/Inscription/templates/_form.php"
10   sfPHPView  Decorate content with "sf_app_dir\templates/layout.php"
11   sfPHPView  Render "sf_app_dir\templates/layout.php"
12   sfWebResponse  Send status "HTTP/1.1 200 OK"
13   sfWebResponse  Send header "Content-Type: text/html; charset=utf-8"

通常、フォームを送信すると、InscriptionForm の値がチェックされますが、必要なすべての値を設定できます。もうコントロールはなく、インデックス関数はインデックスを再度呼び出します。

4

0 に答える 0