diff --git a/feeds.api.php b/feeds.api.php index 6ee490a..c139da1 100644 --- a/feeds.api.php +++ b/feeds.api.php @@ -404,10 +404,11 @@ function my_module_mapper_unique(FeedsSource $source, $entity_type, $bundle, $ta list($field_name, $column) = explode(':', $target . ':value'); // Example for if the target is a field. $query = new EntityFieldQuery(); - $result = $query->entityCondition('entity_type', $entity_type) - ->entityCondition('bundle', $bundle) - ->fieldCondition($field_name, $column, $values) - ->execute(); + $result = $query + ->entityCondition('entity_type', $entity_type) + ->entityCondition('bundle', $bundle) + ->fieldCondition($field_name, $column, $values) + ->execute(); if (!empty($result[$entity_type])) { return key($result[$entity_type]); diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index e10957e..dde65b9 100755 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -751,7 +751,7 @@ abstract class FeedsProcessor extends FeedsPlugin { ->condition('entity_type', $this->entityType()) ->condition('id', $source->id); - static $targets = array(); + $targets = &drupal_static('FeedsProcessor::existingEntityId', array()); if (!isset($targets[$this->id])) { $targets[$this->id] = $this->getMappingTargets(); } diff --git a/tests/feeds_mapper_unique.test b/tests/feeds_mapper_unique.test index 9d0e4a7..46b48dd 100644 --- a/tests/feeds_mapper_unique.test +++ b/tests/feeds_mapper_unique.test @@ -2,7 +2,7 @@ /** * @file - * Conatins FeedsMapperUniqueTestCase. + * Contains FeedsMapperUniqueTestCase. */ /** @@ -69,9 +69,9 @@ class FeedsMapperUniqueTestCase extends FeedsMapperTestCase { // Ensure the updated nodes have the expected title now. $node1 = node_load($node1->nid, NULL, TRUE); - $this->assertEqual('Ut wisi enim ad minim veniam', $node1->title, 'Node 1 has the expected title'); + $this->assertEqual('Ut wisi enim ad minim veniam', $node1->title, 'Node 1 has the expected title.'); $node2 = node_load($node2->nid, NULL, TRUE); - $this->assertEqual('Lorem ipsum', $node2->title, 'Node 2 has the expected title'); + $this->assertEqual('Lorem ipsum', $node2->title, 'Node 2 has the expected title.'); } } diff --git a/tests/feeds_tests.module b/tests/feeds_tests.module index 6c96ccf..fe25704 100644 --- a/tests/feeds_tests.module +++ b/tests/feeds_tests.module @@ -221,10 +221,11 @@ function feeds_tests_mapper_form($mapping, $target, $form, $form_state) { */ function feeds_tests_mapper_unique(FeedsSource $source, $entity_type, $bundle, $target, array $values) { $query = new EntityFieldQuery(); - $result = $query->entityCondition('entity_type', $entity_type) - ->entityCondition('bundle', $bundle) - ->fieldCondition('field_alpha', 'value', $values) - ->execute(); + $result = $query + ->entityCondition('entity_type', $entity_type) + ->entityCondition('bundle', $bundle) + ->fieldCondition('field_alpha', 'value', $values) + ->execute(); if (!empty($result[$entity_type])) { return key($result[$entity_type]);