-
Notifications
You must be signed in to change notification settings - Fork 926
/
Copy pathCachedDaos.php
54 lines (47 loc) · 1.37 KB
/
CachedDaos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @file plugins/importexport/csv/classes/cachedAttributes/CachedDaos.php
*
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class CachedDaos
*
* @ingroup plugins_importexport_csv
*
* @brief This class is responsible for retrieving cached DAOs.
*/
namespace APP\plugins\importexport\csv\classes\cachedAttributes;
use APP\core\Application;
use APP\journal\JournalDAO;
use PKP\db\DAO;
use PKP\db\DAORegistry;
use PKP\galley\DAO as GalleyDAO;
use PKP\submission\GenreDAO;
class CachedDaos
{
/** @var DAO[] */
public static array $cachedDaos = [];
/**
* Retrieves the cached JournalDAO instance.
*/
public static function getJournalDao(): JournalDAO
{
return self::$cachedDaos['JournalDAO'] ??= DAORegistry::getDAO('JournalDAO');
}
/**
* Retrieves the cached GenreDAO instance.
*/
public static function getGenreDao(): GenreDAO
{
return self::$cachedDaos['GenreDAO'] ??= DAORegistry::getDAO('GenreDAO');
}
/**
* Retrieves the cached GalleyDAO instance, which is used for representations.
*/
public static function getRepresentationDao(): GalleyDAO
{
return self::$cachedDaos['RepresentationDAO'] ??= Application::getRepresentationDAO();
}
}