Symfony 1.4,函数create不再被调用

时间:2012-09-23 18:42:54

标签: symfony1 symfony-1.4

我创建了一个允许人们注册的表单,它工作正常,但几周过去了,它已经无法正常工作了。

我的模块铭文带有索引功能:

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);
  }

我的表单显示正确,但如果我提交表单,则不再调用create函数。

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

返回true。

更新案例有效,只是创建没有。我没有错误,只是在配置 - &gt;请求,我有:

parameterHolder:
  action: index
  module: Inscription

好像我的表单调用动作索引而不是create。 我现在正在寻找几个小时,我无法理解为什么。

修改

我提交表格时得到了这个:

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中的值,但我可以设置我想要的每个值;没有控制,索引函数再次调用索引。

0 个答案:

没有答案