aboutsummaryrefslogtreecommitdiff
path: root/lib/sfIsisImporterEntities.class.php
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2010-09-03 18:13:41 -0300
committerSilvio <s1lv10@uol.com.br>2010-09-03 18:13:41 -0300
commitc7a3916e8215deedb95dd9e7aa314ac254120962 (patch)
tree038f78615f776a7fe0187f0e94e94d86f599ee35 /lib/sfIsisImporterEntities.class.php
parent97115d41a806a35a1b027114df725e68d45cb036 (diff)
downloadsf_isis_importer_plugin-c7a3916e8215deedb95dd9e7aa314ac254120962.tar.gz
sf_isis_importer_plugin-c7a3916e8215deedb95dd9e7aa314ac254120962.tar.bz2
newOrExisting with new $by parameter
Diffstat (limited to 'lib/sfIsisImporterEntities.class.php')
-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;