From bbcb70e48de302ab79b8f8468fb098739a9405ed Mon Sep 17 00:00:00 2001 From: Silvio Date: Mon, 27 Sep 2010 15:57:18 -0300 Subject: Method newOrExisting supporting different parsing methods --- lib/sfIsisImporterEntities.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3