Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Favorites
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 saveBulk
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 delete
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * VuFind Action Helper - Favorites Support Methods
5 *
6 * PHP version 8
7 *
8 * Copyright (C) Villanova University 2010.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2,
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 *
23 * @category VuFind
24 * @package  Controller_Plugins
25 * @author   Demian Katz <demian.katz@villanova.edu>
26 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
27 * @link     https://vufind.org Main Page
28 */
29
30namespace VuFind\Controller\Plugin;
31
32use VuFind\Favorites\FavoritesService;
33
34/**
35 * Action helper to perform favorites-related actions
36 *
37 * @category VuFind
38 * @package  Controller_Plugins
39 * @author   Demian Katz <demian.katz@villanova.edu>
40 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
41 * @link     https://vufind.org Main Page
42 *
43 * @deprecated Use \VuFind\Favorites\FavoritesService
44 */
45class Favorites extends \Laminas\Mvc\Controller\Plugin\AbstractPlugin
46{
47    /**
48     * Constructor
49     *
50     * @param FavoritesService $favoritesService Favorites service
51     */
52    public function __construct(
53        protected FavoritesService $favoritesService,
54    ) {
55    }
56
57    /**
58     * Save a group of records to the user's favorites.
59     *
60     * @param array               $params Array with some or all of these keys:
61     *  <ul>
62     *    <li>ids - Array of IDs in source|id format</li>
63     *    <li>mytags - Unparsed tag string to associate with record (optional)</li>
64     *    <li>list - ID of list to save record into (omit to create new list)</li>
65     *  </ul>
66     * @param UserEntityInterface $user   The user saving the record
67     *
68     * @return array list information
69     *
70     * @deprecated Use \VuFind\Favorites\FavoritesService::saveRecordsToFavorites()
71     */
72    public function saveBulk($params, $user)
73    {
74        return $this->favoritesService->saveRecordsToFavorites($params, $user);
75    }
76
77    /**
78     * Delete a group of favorites.
79     *
80     * @param array               $ids    Array of IDs in source|id format.
81     * @param mixed               $listID ID of list to delete from (null for all lists)
82     * @param UserEntityInterface $user   Logged in user
83     *
84     * @return void
85     *
86     * @deprecated Use \VuFind\Favorites\FavoritesService::deleteFavorites()
87     */
88    public function delete($ids, $listID, $user)
89    {
90        $this->favoritesService->deleteFavorites($ids, $listID, $user);
91    }
92}