aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-09-27 15:57:18 -0300
committerSilvio <silvio@devlet.com.br>2010-09-27 15:57:18 -0300
commitbbcb70e48de302ab79b8f8468fb098739a9405ed (patch)
tree2da3644aac533808de63ea617dabafc4bd506f43
parentbb31ca3127470a2abf15b5110e8b80f9fdc6e4a3 (diff)
downloadsf_isis_importer_plugin-bbcb70e48de302ab79b8f8468fb098739a9405ed.tar.gz
sf_isis_importer_plugin-bbcb70e48de302ab79b8f8468fb098739a9405ed.tar.bz2
Method newOrExisting supporting different parsing methods
-rw-r--r--lib/sfIsisImporterEntities.class.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/sfIsisImporterEntities.class.php b/lib/sfIsisImporterEntities.class.php
index a371462..5c85c3d 100644
--- a/lib/sfIsisImporterEntities.class.php
+++ b/lib/sfIsisImporterEntities.class.php
@@ -184,8 +184,18 @@ class sfIsisImporterEntities {
return;
}
+ // Determine parse method.
+ if (method_exists($this, 'parse'. $entity .'Name'))
+ {
+ $method = 'parse'. $entity .'Name';
+ }
+ else
+ {
+ $method = 'parseName';
+ }
+
// Get existing element.
- $name = ($by == 'Name') ? $this->parseName($value) : $value;
+ $name = ($by == 'Name') ? $this->{$method}($value) : $value;
$element = call_user_func(array($entity, 'getBy'. $by), $name);
// Create new element if needed.