bkuberek

sfFormObject::saveEmbeddedForms()

Mar 15th, 2011
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. // symfony 1.4.10-DEV
  2. // sfFormObject.class.php : line ~ 229  
  3.  
  4. public function saveEmbeddedForms($con = null, $forms = null)
  5.   {
  6.     if (null === $con)
  7.     {
  8.       $con = $this->getConnection();
  9.     }
  10.  
  11.     if (null === $forms)
  12.     {
  13.       $forms = $this->embeddedForms;
  14.     }
  15.  
  16.     foreach ($forms as $form)
  17.     {
  18.       if ($form instanceof sfFormObject)
  19.       {
  20.         $form->saveEmbeddedForms($con);
  21.         $form->getObject()->save($con);
  22.       }
  23.       else
  24.       {
  25.         $this->saveEmbeddedForms($con, $form->getEmbeddedForms());
  26.       }
  27.     }
  28.   }
  29.  
  30.  
  31.  
  32. //
  33. // I dont understand why
  34. //
  35. //      $form->saveEmbeddedForms($con);
  36. //      $form->getObject()->save($con);
  37.  
  38. // instead of
  39. //
  40. //      $form->save($con);
  41.  
  42.  
  43.  
  44. public function saveEmbeddedForms($con = null, $forms = null)
  45.   {
  46.     if (null === $con)
  47.     {
  48.       $con = $this->getConnection();
  49.     }
  50.  
  51.     if (null === $forms)
  52.     {
  53.       $forms = $this->embeddedForms;
  54.     }
  55.  
  56.     foreach ($forms as $form)
  57.     {
  58.       if ($form instanceof sfFormObject)
  59.       {
  60.         $form->save($con);
  61.       }
  62.       else
  63.       {
  64.         $this->saveEmbeddedForms($con, $form->getEmbeddedForms());
  65.       }
  66.     }
  67.   }
Advertisement
Add Comment
Please, Sign In to add comment