protected function handleForm(sfFormDoctrine $form, $uri = null, $action = null, $params = null)
 {
     if ($this->getRequest()->isMethod('post')) {
         $request = $this->getRequest();
         $formname = $form->getName();
         $form->bind($request->getPostParameter($formname), $form->isMultipart() ? $request->getFiles($formname) : null);
         if ($form->isValid()) {
             $form->save();
             if (is_array($action)) {
                 $params = $action;
             }
             if (is_array($params)) {
                 $url = $this->getContext()->getRouting()->generate($uri . (is_string($action) ? '/' . $action : ''), $params, true);
                 $this->redirect($url);
             }
             if (is_string($uri)) {
                 if ($action === null) {
                     $this->redirect($uri);
                 } else {
                     $this->forward($uri, $action);
                 }
             }
         }
     }
 }