Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/Controller/OmniaController.php b/src/Controller/OmniaController.php
- index f3820b8..738710c 100644
- --- a/src/Controller/OmniaController.php
- +++ b/src/Controller/OmniaController.php
- @@ -400,7 +400,7 @@ class OmniaController extends ControllerBase {
- }
- if (!empty($tagField)) {
- - $mapped_tag_ids = $this->mapMultipleTermIds($tag_ids, 'tags');
- + $mapped_tag_ids = $this->mapMultipleTermIds($tag_ids);
- $media->$tagField = $mapped_tag_ids;
- }
- @@ -438,7 +438,7 @@ class OmniaController extends ControllerBase {
- * @return int[]
- * Array of mapped drupal ids, might contain less ids then the input array.
- */
- - protected function mapMultipleTermIds(array $omnia_ids, $vid) {
- + protected function mapMultipleTermIds(array $omnia_ids, $vid = NULL) {
- $drupal_ids = [];
- foreach ($omnia_ids as $omnia_id) {
- $drupalId = $this->mapTermId($omnia_id, $vid);
- @@ -468,12 +468,15 @@ class OmniaController extends ControllerBase {
- * @return int
- * The drupal id of the term.
- */
- - protected function mapTermId($omnia_id, $vid) {
- + protected function mapTermId($omnia_id, $vid = NULL) {
- $result = $this->database->select('nexx_taxonomy_term_data', 'n')
- ->fields('n', ['tid'])
- - ->condition('n.nexx_item_id', $omnia_id)
- - ->condition('n.vid', $vid)
- - ->execute();
- + ->condition('n.nexx_item_id', $omnia_id);
- +
- + if (!empty($vid)) {
- + $result->condition('n.vid', $vid);
- + }
- + $result->execute();
- $drupal_id = $result->fetchField();
Add Comment
Please, Sign In to add comment