diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sfIsisImporter.class.php | 1 | ||||
-rw-r--r-- | lib/sfIsisImporterRelations.class.php | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/sfIsisImporter.class.php b/lib/sfIsisImporter.class.php index 9b2273a..4b2d587 100644 --- a/lib/sfIsisImporter.class.php +++ b/lib/sfIsisImporter.class.php @@ -104,6 +104,7 @@ class sfIsisImporter extends sfIsisImporterRelations { if (!$this->hasDeniedCombinations($base_model, $field)) { + $this->log("Calling $method for field ". $field['name'] .'.', 'debug'); $this->{$method}($model, $field); } } diff --git a/lib/sfIsisImporterRelations.class.php b/lib/sfIsisImporterRelations.class.php index bf41120..248bf99 100644 --- a/lib/sfIsisImporterRelations.class.php +++ b/lib/sfIsisImporterRelations.class.php @@ -151,9 +151,19 @@ class sfIsisImporterRelations extends sfIsisImporterEntities { */ public function addManyToManyEntities(&$model, array $values, $relation, $key = 'name') { + $existing = array(); + foreach ($values as $value) { - $this->addManyToMany($model, $value, $relation, $key); + // Prevent duplicate entries. + if (!in_array($value, $existing)) + { + $existing[] = $value; + $this->addManyToMany($model, $value, $relation, $key); + } + else { + $this->log("Found duplicate entry $value for relation $key.", 'debug'); + } } } |