aboutsummaryrefslogtreecommitdiff
path: root/lib/sfIsisImporter.class.php
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2010-08-09 12:24:41 -0300
committerSilvio <s1lv10@uol.com.br>2010-08-09 12:24:41 -0300
commit3ac0e8cbbc0d655234c863291585a7e40d905147 (patch)
treefa79296b19198fbf002827d766dabba43983f068 /lib/sfIsisImporter.class.php
parent831477c2045d4db7db669c2abf1a95c31ed0701b (diff)
downloadsf_isis_importer_plugin-3ac0e8cbbc0d655234c863291585a7e40d905147.tar.gz
sf_isis_importer_plugin-3ac0e8cbbc0d655234c863291585a7e40d905147.tar.bz2
Adding method skipExisting at sfIsisImporter
Diffstat (limited to 'lib/sfIsisImporter.class.php')
-rw-r--r--lib/sfIsisImporter.class.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/sfIsisImporter.class.php b/lib/sfIsisImporter.class.php
index 22541e3..d0d9a9f 100644
--- a/lib/sfIsisImporter.class.php
+++ b/lib/sfIsisImporter.class.php
@@ -142,21 +142,43 @@ class sfIsisImporter extends IsisConnector
if ($id)
{
- if (!call_user_func(array($base_model, 'getById'), $id))
+ $existing = call_user_func(array($base_model, 'getById'), $id);
+
+ if (!$existing)
{
$this->setBaseModelId($model);
return $model;
}
- else
+ elseif ($this->skipExisting())
{
return false;
}
+ else
+ {
+ return $existing;
+ }
}
return $model;
}
/**
+ * Check if ISIS database configuration is set to not skip existing
+ * entries during an import.
+ *
+ * @return boolean
+ */
+ public function skipExisting()
+ {
+ if (isset($this->format['import']['skip_existing']))
+ {
+ return $this->format['import']['skip_existing'];
+ }
+
+ return true;
+ }
+
+ /**
* Set the primary key for the model by getting it or just saving it.
*
* @param object $model Base model