diff --git a/module/VuFind/src/VuFind/Db/Table/UserList.php b/module/VuFind/src/VuFind/Db/Table/UserList.php index ee3a9a1ce243f4f2a287d1c87cd1681b6415d5aa..1a1c2db9a59065d43c6736303f0c9577409313fe 100644 --- a/module/VuFind/src/VuFind/Db/Table/UserList.php +++ b/module/VuFind/src/VuFind/Db/Table/UserList.php @@ -26,6 +26,8 @@ * @link http://www.vufind.org Main Page */ namespace VuFind\Db\Table; +use VuFind\Exception\LoginRequired as LoginRequiredException, + VuFind\Exception\RecordMissing as RecordMissingException; /** * Table Definition for user_list @@ -52,20 +54,20 @@ class UserList extends Gateway * @param VuFind_Model_Db_UserListRow $user User object representing owner of * new list * - * @return VuFind_Model_Db_UserListRow + * @return \VuFind\Db\Row\UserList + * @throws LoginRequiredException */ public static function getNew($user) { - /* TODO if (!$user) { - throw new VF_Exception_LoginRequired('Log in to create lists.'); + throw new LoginRequiredException('Log in to create lists.'); } - $table = new VuFind_Model_Db_UserList(); - $row = $table->createRow(); + $class = get_called_class(); + $table = new $class(); + $row = clone($table->getResultSetPrototype()->getArrayObjectPrototype()); $row->user_id = $user->id; return $row; - */ } /** @@ -73,19 +75,18 @@ class UserList extends Gateway * * @param int $id Numeric ID for existing list. * - * @return VuFind_Model_Db_UserListRow - * @throws VF_Exception_RecordMissing + * @return \VuFind\Db\Row\UserList + * @throws RecordMissingException */ public static function getExisting($id) { - /* TODO - $table = new VuFind_Model_Db_UserList(); - $result = $table->find($id)->current(); + $class = get_called_class(); + $table = new $class(); + $result = $table->select(array('id' => $id))->current(); if (is_null($result)) { - throw new VF_Exception_RecordMissing('Cannot load list ' . $id); + throw new RecordMissingException('Cannot load list ' . $id); } return $result; - */ } /** diff --git a/module/VuFind/src/VuFind/Search/Favorites/Results.php b/module/VuFind/src/VuFind/Search/Favorites/Results.php index a1f6c2981a5a477d0fb9a7042bcad523c1c7ea9d..62b8537c28cb28ec70d0153fb7c901d97a851bf5 100644 --- a/module/VuFind/src/VuFind/Search/Favorites/Results.php +++ b/module/VuFind/src/VuFind/Search/Favorites/Results.php @@ -27,6 +27,7 @@ */ namespace VuFind\Search\Favorites; use VuFind\Db\Table\Resource as ResourceTable, + VuFind\Db\Table\UserList as UserListTable, VuFind\Exception\ListPermission as ListPermissionException, VuFind\Record, VuFind\Search\Base\Results as BaseResults, @@ -205,7 +206,7 @@ class Results extends BaseResults * Get the list object associated with the current search (null if no list * selected). * - * @return VuFind_Model_Db_UserListRow|null + * @return \VuFind\Db\Row\UserList|null */ public function getListObject() { @@ -216,7 +217,7 @@ class Results extends BaseResults $filters = $this->params->getFilters(); $listId = isset($filters['lists'][0]) ? $filters['lists'][0] : null; $this->list = is_null($listId) - ? null : VuFind_Model_Db_UserList::getExisting($listId); + ? null : UserListTable::getExisting($listId); } return $this->list; }