Development

#2898 (Validation example in 'My first symfony project' doesn't handle updates)

You must first sign up to be able to contribute.

Ticket #2898 (closed documentation: fixed)

Opened 10 months ago

Last modified 7 months ago

Validation example in 'My first symfony project' doesn't handle updates

Reported by: jslag Assigned to: fabien
Priority: minor Milestone:
Component: other Version: 1.0.10
Keywords: tutorial Cc:
Qualification: Unreviewed

Description

the tutorial has the following function:

public function handleErrorUpdate()
{
  $this->forward('comment', 'create');
}

However, this doesn't behave properly when editing an existing record. Better to use something like the following, from http://www.symfony-project.org/forum/index.php/m/44965/

public function handleErrorUpdate()
  {
    // forward it to edit if the id exists
    if (!$this->getRequestParameter('id'))
    {
      $this->forward('signup', 'create');
    }
    else
    {
      $this->forward('signup', 'edit');
    }
  }

http://www.symfony-project.org/tutorial/1_0/my-first-project

Change History

05/13/08 13:31:51 changed by FabianLange

  • status changed from new to closed.
  • resolution set to fixed.

(In [8927]) updated validation example in my-first-project to work fine with editing. Fixes #2898

05/13/08 13:44:53 changed by Markus.Staab

  • status changed from closed to reopened.
  • resolution deleted.

wouldn't it be better to check if the id is valid, not only for existance?

05/13/08 13:54:15 changed by FabianLange

  • status changed from reopened to closed.
  • resolution set to fixed.

for what purpose? This is not the validation, its sthe decision where to redirect to after failed validation.