aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-11-17 17:19:14 -0200
committerSilvio <silvio@devlet.com.br>2010-11-17 17:19:14 -0200
commitced00d51e39f2924ba98451673ca69bcf5fb52ac (patch)
tree79beefcf0c0ab2c3115154eb8dfd197d01ccda05 /lib
parentb549a90ac492bca7c6915d66db5677f2b9016def (diff)
downloadsf_isis_importer_plugin-ced00d51e39f2924ba98451673ca69bcf5fb52ac.tar.gz
sf_isis_importer_plugin-ced00d51e39f2924ba98451673ca69bcf5fb52ac.tar.bz2
Avoiding duplicate entries at addManyToManyEntities() by looking into the database
Diffstat (limited to 'lib')
-rw-r--r--lib/sfIsisImporterRelations.class.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/sfIsisImporterRelations.class.php b/lib/sfIsisImporterRelations.class.php
index 248bf99..49ec9f2 100644
--- a/lib/sfIsisImporterRelations.class.php
+++ b/lib/sfIsisImporterRelations.class.php
@@ -151,14 +151,13 @@ class sfIsisImporterRelations extends sfIsisImporterEntities {
*/
public function addManyToManyEntities(&$model, array $values, $relation, $key = 'name')
{
- $existing = array();
-
foreach ($values as $value)
{
+ $existing = $this->getEntity($relation, $value, $key);
+
// Prevent duplicate entries.
- if (!in_array($value, $existing))
+ if (!$existing)
{
- $existing[] = $value;
$this->addManyToMany($model, $value, $relation, $key);
}
else {