Author: francois
Date: 2010-05-14 17:45:17 +0200 (Fri, 14 May 2010)
New Revision: 29470

Modified:
   plugins/sfPropel15Plugin/trunk/lib/form/sfFormPropel.class.php
Log:
[sfPropel15Plugin] Tweaked embedded relation deletion

Modified: plugins/sfPropel15Plugin/trunk/lib/form/sfFormPropel.class.php
===================================================================
--- plugins/sfPropel15Plugin/trunk/lib/form/sfFormPropel.class.php      
2010-05-14 15:30:15 UTC (rev 29469)
+++ plugins/sfPropel15Plugin/trunk/lib/form/sfFormPropel.class.php      
2010-05-14 15:45:17 UTC (rev 29470)
@@ -196,8 +196,12 @@
     $this->updateObject();
     
     // this is Propel specific
-    if(!$this->getObject()->isDeleted())
+    if(isset($this->getObject()->markForDeletion))
     {
+      $this->getObject()->delete($con);
+    }
+    else
+    {
       $this->getObject()->save($con);
     }
 
@@ -220,7 +224,7 @@
     {
       if (isset($values[$this->getDeleteField()]) && 
$values[$this->getDeleteField()])
       {
-        $this->getObject()->delete();
+        $this->getObject()->markForDeletion = true;
         return;
       }
     }
@@ -253,8 +257,12 @@
       {
         $form->saveEmbeddedForms($con);
         // this is Propel specific
-        if(!$form->getObject()->isDeleted())
+        if(isset($form->getObject()->markForDeletion))
         {
+          $form->getObject()->delete($con);
+        }
+        else
+        {
           $form->getObject()->save($con);
         }
       }
@@ -609,7 +617,7 @@
     
     // compute relation fields, to be removed from embedded forms
     // because this data is not editable
-    $relationFields = $this->getRelationFields($relationMap);
+    $options['remove_fields'] = $this->getRelationFields($relationMap);
     
     // create the relation form
     $collectionFormClass = $options['collection_form_class'];

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to