aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sfIsisImporterEntities.class.php10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/sfIsisImporterEntities.class.php b/lib/sfIsisImporterEntities.class.php
index 73fe3af..a371462 100644
--- a/lib/sfIsisImporterEntities.class.php
+++ b/lib/sfIsisImporterEntities.class.php
@@ -175,7 +175,7 @@ class sfIsisImporterEntities {
* @param string $value Entity value
* @return object Entity data
*/
- public function newOrExisting($entity, $value)
+ public function newOrExisting($entity, $value, $by = 'Name')
{
// Check for a null value.
if ($value == null)
@@ -184,17 +184,15 @@ class sfIsisImporterEntities {
return;
}
- // Get name.
- $name = $this->parseName($value);
-
// Get existing element.
- $element = call_user_func(array($entity, 'getByName'), $name);
+ $name = ($by == 'Name') ? $this->parseName($value) : $value;
+ $element = call_user_func(array($entity, 'getBy'. $by), $name);
// Create new element if needed.
if (!$element)
{
$this->log("Adding new $entity $value.");
- $element = call_user_func(array($entity, 'addByName'), $name);
+ $element = call_user_func(array($entity, 'addBy'. $by), $name);
}
return $element;