Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| common_persistence_Manager | |
0.00% |
0 / 11 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| getDefaultManager | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| getPersistence | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| addPersistence | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | use oat\oatbox\service\ServiceManager; |
| 23 | use oat\oatbox\service\ServiceNotFoundException; |
| 24 | use oat\generis\persistence\PersistenceManager; |
| 25 | |
| 26 | /** |
| 27 | * A backward compatibility wrapper for our persistence factory |
| 28 | * |
| 29 | * @author Lionel Lecaque <lionel@taotesting.com> |
| 30 | * @license GPLv2 |
| 31 | * @package generis |
| 32 | * @deprecated use PersistenceManager |
| 33 | */ |
| 34 | class common_persistence_Manager extends PersistenceManager |
| 35 | { |
| 36 | /** @deprecated */ |
| 37 | public const SERVICE_KEY = 'generis/persistences'; |
| 38 | |
| 39 | /** |
| 40 | * @return common_persistence_Manager |
| 41 | * @deprecated |
| 42 | */ |
| 43 | protected static function getDefaultManager() |
| 44 | { |
| 45 | try { |
| 46 | $manager = ServiceManager::getServiceManager()->get(self::SERVICE_ID); |
| 47 | } catch (ServiceNotFoundException $ex) { |
| 48 | $manager = new self([ |
| 49 | self::OPTION_PERSISTENCES => [] |
| 50 | ]); |
| 51 | $manager->setServiceManager(ServiceManager::getServiceManager()); |
| 52 | } |
| 53 | return $manager; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * |
| 58 | * @param string $persistenceId |
| 59 | * @return common_persistence_Persistence |
| 60 | * @deprecated |
| 61 | */ |
| 62 | public static function getPersistence($persistenceId) |
| 63 | { |
| 64 | return self::getDefaultManager()->getPersistenceById($persistenceId); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Add a new persistence to the system |
| 69 | * |
| 70 | * @param string $persistenceId |
| 71 | * @param array $persistenceConf |
| 72 | * @deprecated |
| 73 | */ |
| 74 | public static function addPersistence($persistenceId, array $persistenceConf) |
| 75 | { |
| 76 | $manager = self::getDefaultManager(); |
| 77 | $manager->registerPersistence($persistenceId, $persistenceConf); |
| 78 | $manager->getServiceManager()->register(self::SERVICE_ID, $manager); |
| 79 | } |
| 80 | } |