Guest User

Untitled

a guest
Nov 21st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. diff --git a/src/Controller/OmniaController.php b/src/Controller/OmniaController.php
  2. index f3820b8..738710c 100644
  3. --- a/src/Controller/OmniaController.php
  4. +++ b/src/Controller/OmniaController.php
  5. @@ -400,7 +400,7 @@ class OmniaController extends ControllerBase {
  6. }
  7.  
  8. if (!empty($tagField)) {
  9. - $mapped_tag_ids = $this->mapMultipleTermIds($tag_ids, 'tags');
  10. + $mapped_tag_ids = $this->mapMultipleTermIds($tag_ids);
  11. $media->$tagField = $mapped_tag_ids;
  12. }
  13.  
  14. @@ -438,7 +438,7 @@ class OmniaController extends ControllerBase {
  15. * @return int[]
  16. * Array of mapped drupal ids, might contain less ids then the input array.
  17. */
  18. - protected function mapMultipleTermIds(array $omnia_ids, $vid) {
  19. + protected function mapMultipleTermIds(array $omnia_ids, $vid = NULL) {
  20. $drupal_ids = [];
  21. foreach ($omnia_ids as $omnia_id) {
  22. $drupalId = $this->mapTermId($omnia_id, $vid);
  23. @@ -468,12 +468,15 @@ class OmniaController extends ControllerBase {
  24. * @return int
  25. * The drupal id of the term.
  26. */
  27. - protected function mapTermId($omnia_id, $vid) {
  28. + protected function mapTermId($omnia_id, $vid = NULL) {
  29. $result = $this->database->select('nexx_taxonomy_term_data', 'n')
  30. ->fields('n', ['tid'])
  31. - ->condition('n.nexx_item_id', $omnia_id)
  32. - ->condition('n.vid', $vid)
  33. - ->execute();
  34. + ->condition('n.nexx_item_id', $omnia_id);
  35. +
  36. + if (!empty($vid)) {
  37. + $result->condition('n.vid', $vid);
  38. + }
  39. + $result->execute();
  40.  
  41. $drupal_id = $result->fetchField();
Add Comment
Please, Sign In to add comment