Author: jablko
Date: Fri Oct 29 17:37:08 2010
New Revision: 8702

Log:
Only append new events and relations

Modified:
   trunk/apps/qubit/modules/event/actions/editComponent.class.php
   trunk/apps/qubit/modules/relation/actions/editComponent.class.php
   
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php

Modified: trunk/apps/qubit/modules/event/actions/editComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/event/actions/editComponent.class.php      Fri Oct 
29 17:01:55 2010        (r8701)
+++ trunk/apps/qubit/modules/event/actions/editComponent.class.php      Fri Oct 
29 17:37:08 2010        (r8702)
@@ -122,16 +122,19 @@
         continue;
       }
 
-      $this->event = new QubitEvent;
-      if (!isset($this->request->source) && isset($item['id']))
-      {
-        $params = $this->context->routing->parse(Qubit::pathInfo($item['id']));
-        $this->event = $params['_sf_route']->resource;
-      }
-
       $this->form->bind($item);
       if ($this->form->isValid())
       {
+        if (!isset($this->request->source) && isset($item['id']))
+        {
+          $params = 
$this->context->routing->parse(Qubit::pathInfo($item['id']));
+          $this->event = $params['_sf_route']->resource;
+        }
+        else
+        {
+          $this->resource->events[] = $this->event = new QubitEvent;
+        }
+
         foreach ($this->form as $field)
         {
           if (isset($item[$field->getName()]))
@@ -139,8 +142,6 @@
             $this->processField($field);
           }
         }
-
-        $this->resource->events[] = $this->event;
       }
     }
 

Modified: trunk/apps/qubit/modules/relation/actions/editComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/relation/actions/editComponent.class.php   Fri Oct 
29 17:01:55 2010        (r8701)
+++ trunk/apps/qubit/modules/relation/actions/editComponent.class.php   Fri Oct 
29 17:37:08 2010        (r8702)
@@ -136,16 +136,19 @@
         continue;
       }
 
-      $this->relation = new QubitRelation;
-      if (isset($item['id']))
-      {
-        $params = $this->context->routing->parse(Qubit::pathInfo($item['id']));
-        $this->relation = $params['_sf_route']->resource;
-      }
-
       $this->form->bind($item);
       if ($this->form->isValid())
       {
+        if (isset($item['id']))
+        {
+          $params = 
$this->context->routing->parse(Qubit::pathInfo($item['id']));
+          $this->relation = $params['_sf_route']->resource;
+        }
+        else
+        {
+          $this->resource->relationsRelatedBysubjectId[] = $this->relation = 
new QubitRelation;
+        }
+
         foreach ($this->form as $field)
         {
           if (isset($item[$field->getName()]))
@@ -153,8 +156,6 @@
             $this->processField($field);
           }
         }
-
-        $this->resource->relationsRelatedBysubjectId[] = $this->relation;
       }
     }
   }

Modified: 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
==============================================================================
--- 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
    Fri Oct 29 17:01:55 2010        (r8701)
+++ 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
    Fri Oct 29 17:37:08 2010        (r8702)
@@ -47,16 +47,19 @@
         continue;
       }
 
-      $this->event = new QubitEvent;
-      if (!isset($this->request->source) && isset($item['id']))
-      {
-        $params = $this->context->routing->parse(Qubit::pathInfo($item['id']));
-        $this->event = $params['_sf_route']->resource;
-      }
-
       $this->form->bind($item);
       if ($this->form->isValid())
       {
+        if (!isset($this->request->source) && isset($item['id']))
+        {
+          $params = 
$this->context->routing->parse(Qubit::pathInfo($item['id']));
+          $this->event = $params['_sf_route']->resource;
+        }
+        else
+        {
+          $this->resource->events[] = $this->event = new QubitEvent;
+        }
+
         foreach ($this->form as $field)
         {
           if (isset($item[$field->getName()]))
@@ -64,8 +67,6 @@
             $this->processField($field);
           }
         }
-
-        $this->resource->events[] = $this->event;
       }
     }
 

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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/qubit-commits?hl=en.

Reply via email to