Author: peter
Date: Sun Sep 20 14:57:56 2009
New Revision: 3446

Log:
set term root when dynamically creating new terms upon import. fixes issue #965

Modified:
   trunk/lib/model/QubitInformationObject.php
   trunk/lib/model/QubitTerm.php

Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php  Sun Sep 20 14:53:09 2009        
(r3445)
+++ trunk/lib/model/QubitInformationObject.php  Sun Sep 20 14:57:56 2009        
(r3446)
@@ -1432,6 +1432,7 @@
         $term = new QubitTerm;
         $term->setTaxonomyId(QubitTaxonomy::LEVEL_OF_DESCRIPTION_ID);
         $term->setName($name);
+        $term->setRoot();
         $term->save();
         $this->setLevelOfDescriptionId($term->getId());
       }
@@ -1480,6 +1481,7 @@
         $term = new QubitTerm;
         $term->setTaxonomyId(QubitTaxonomy::EVENT_TYPE_ID);
         $term->setName($eventType);
+        $term->setRoot();
         $term->save();
         $eventTypeId = $term->getId();
       }
@@ -1588,6 +1590,7 @@
       $newTerm = new QubitTerm;
       $newTerm->setTaxonomyId($options['taxonomyId']);
       $newTerm->setName($term);
+      $newTerm->setRoot();
       $newTerm->save();
       if (isset($options['source']))
       {

Modified: trunk/lib/model/QubitTerm.php
==============================================================================
--- trunk/lib/model/QubitTerm.php       Sun Sep 20 14:53:09 2009        (r3445)
+++ trunk/lib/model/QubitTerm.php       Sun Sep 20 14:57:56 2009        (r3446)
@@ -162,6 +162,11 @@
     return (string) $this->getName();
   }
 
+  public function setRoot()
+  {
+    $this->setParentId(QubitTerm::ROOT_ID);
+  }
+
   public function delete($connection = null)
   {
     // Cascade delete descendants

--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to