Author: mcantelon
Date: Wed Feb  1 14:08:53 2012
New Revision: 10788

Log:
Added logic to allow per-object disabling of nested set updating (for bulk 
imports).

Modified:
   trunk/lib/QubitFlatfileImport.class.php
   trunk/lib/model/QubitInformationObject.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Wed Feb  1 00:03:29 2012        
(r10787)
+++ trunk/lib/QubitFlatfileImport.class.php     Wed Feb  1 14:08:53 2012        
(r10788)
@@ -378,6 +378,12 @@
     {
       // create new object
       $this->object = new $this->className;
+
+      // disable nested set updating, if applicable to object type
+      if (property_exists(get_class($this->object), 
'disableNestedSetUpdating'))
+      {
+        $this->object->disableNestedSetUpdating = TRUE;
+      }
     } else {
       // execute ad-hoc row initialization logic (which can make objects, load
       // them, etc.)

Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php  Wed Feb  1 00:03:29 2012        
(r10787)
+++ trunk/lib/model/QubitInformationObject.php  Wed Feb  1 14:08:53 2012        
(r10788)
@@ -33,6 +33,9 @@
   const
     ROOT_ID = 1;
 
+  // allow per-object disabling of nested set updating during bulk imports
+  public $disableNestedSetUpdating = FALSE;
+
   /**
    * When cast as a string, return i18n-ized object title with fallback to
    * source culture
@@ -471,6 +474,14 @@
     $this->parentId = $parentId;
   }
 
+  protected function updateNestedSet($connection = null)
+  {
+    if (!$this->disableNestedSetUpdating)
+    {
+      return parent::updateNestedSet($connection);
+    }
+  }
+
   /***********************
    Actor/Event relations
   ************************/

-- 
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