From 6a545fe6cf8cfd35457a46f6fd83be994223e28e Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Mon, 30 Jan 2017 16:15:28 +0200
Subject: [PATCH] Return the added/updated history row so that the caller can
 do something with it. (#898)

---
 module/VuFind/src/VuFind/Db/Table/Search.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/module/VuFind/src/VuFind/Db/Table/Search.php b/module/VuFind/src/VuFind/Db/Table/Search.php
index d3a1f75ab79..55771c400be 100644
--- a/module/VuFind/src/VuFind/Db/Table/Search.php
+++ b/module/VuFind/src/VuFind/Db/Table/Search.php
@@ -5,7 +5,7 @@
  * PHP version 5
  *
  * Copyright (C) Villanova University 2010.
- * Copyright (C) The National Library of Finland 2016.
+ * Copyright (C) The National Library of Finland 2016-2017.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2,
@@ -204,7 +204,7 @@ class Search extends Gateway
      * @param string                               $sessionId Current session ID
      * @param int|null                             $userId    Current user ID
      *
-     * @return void
+     * @return \VuFind\Db\Row\Search
      */
     public function saveSearch(\VuFind\Search\Results\PluginManager $manager,
         $newSearch, $sessionId, $userId
@@ -251,7 +251,7 @@ class Search extends Gateway
                 }
                 // Update the new search from the existing one
                 $newSearch->updateSaveStatus($oldSearch);
-                return;
+                return $oldSearch;
             }
         }
 
@@ -269,6 +269,7 @@ class Search extends Gateway
         $row->session_id = $sessionId;
         $row->search_object = serialize(new minSO($newSearch));
         $row->save();
+        return $row;
     }
 
     /**
-- 
GitLab