Author: david
Date: Fri Aug  3 11:10:49 2012
New Revision: 12041

Log:
Allow createActor() method to take entityTypeId parameter

Modified:
   trunk/lib/QubitFlatfileImport.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Fri Aug  3 11:09:43 2012        
(r12040)
+++ trunk/lib/QubitFlatfileImport.class.php     Fri Aug  3 11:10:49 2012        
(r12041)
@@ -994,8 +994,13 @@
       else
       {
         // Link actor
-        $history = isset($options['actorHistory']) ? $options['actorHistory'] 
: false;
-        $actor = $this->createOrFetchActor($options['actorName'], $history);
+        $actorOptions = array();
+        if (isset($options['actorHistory']))
+        {
+          $actorOptions['history'] = $options['actorHistory'];
+        }
+
+        $actor = $this->createOrFetchActor($options['actorName'], 
$actorOptions);
         $event->actorId = $actor->id;
       }
     }
@@ -1055,12 +1060,12 @@
   /**
    * Create a Qubit actor or, if one already exists, fetch it
    *
-   * @param string $name  name of actor
-   * @param string $history  history of actor (optional)
+   * @param string $name     name of actor
+   * @param string $options  optional data
    *
    * @return QubitActor  created or fetched actor
    */
-  public function createOrFetchActor($name, $history = false)
+  public function createOrFetchActor($name, $options = array())
   {
     $query = "SELECT id FROM actor_i18n WHERE authorized_form_of_name=?";
 
@@ -1071,7 +1076,7 @@
     {
       return QubitActor::getById($result->id);
     } else {
-      return $this->createActor($name, $history);
+      return $this->createActor($name, $options);
     }
   }
 
@@ -1245,15 +1250,22 @@
    *
    * @return QubitActor  created actor
    */
-  public function createActor($name, $history = false)
+  public function createActor($name, $options = array())
   {
     $actor = new QubitActor;
     $actor->parentId = QubitActor::ROOT_ID;
     $actor->authorizedFormOfName = $name;
-    if ($history)
+
+    if (isset($options['history']))
     {
-      $actor->history = $history;
+      $actor->history = $options['history'];
     }
+
+    if (isset($options['entityTypeId']))
+    {
+      $actor->entityTypeId = $options['entityTypeId'];
+    }
+
     $actor->save();
     return $actor;
   }

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