From 3cbaa685d35683473f2a13107999108344df2aa7 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 3 Jul 2015 16:59:03 +0200 Subject: [PATCH] Used more DatabaseWrapperFactory as one instance of each is fine. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- inc/classes/main/class_BaseFrameworkSystem.php | 2 +- .../main/database/frontend/class_NewsDatabaseWrapper.php | 3 ++- .../main/database/frontend/class_PaymentsDatabaseWrapper.php | 3 ++- .../main/database/frontend/class_UserDatabaseWrapper.php | 2 +- .../main/database/frontend/class_UserPointsDatabaseWrapper.php | 2 +- .../main/discovery/payment/class_LocalPaymentDiscovery.php | 2 +- inc/classes/main/points/class_UserPoints.php | 2 +- inc/classes/main/reader/class_ConsoleNewsReader.php | 2 +- inc/classes/main/reader/class_DefaultNewsReader.php | 2 +- 9 files changed, 11 insertions(+), 9 deletions(-) diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 56b1cbfa..42051702 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -2199,7 +2199,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $configEntry = $resultInstance->getUpdateInstance()->getWrapperConfigEntry(); // Create object instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName($configEntry); + $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName($configEntry); // Yes, then send the whole result to the database layer $wrapperInstance->doUpdateByResult($this->getResultInstance()); diff --git a/inc/classes/main/database/frontend/class_NewsDatabaseWrapper.php b/inc/classes/main/database/frontend/class_NewsDatabaseWrapper.php index 80a2a8ef..328a0e29 100644 --- a/inc/classes/main/database/frontend/class_NewsDatabaseWrapper.php +++ b/inc/classes/main/database/frontend/class_NewsDatabaseWrapper.php @@ -7,6 +7,7 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org + * @todo Add missing own interface for public methods * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class NewsDatabaseWrapper extends BaseDatabaseWrapper { +class NewsDatabaseWrapper extends BaseDatabaseWrapper implements Registerable { // Constants for database table names const DB_TABLE_NEWS = 'news'; diff --git a/inc/classes/main/database/frontend/class_PaymentsDatabaseWrapper.php b/inc/classes/main/database/frontend/class_PaymentsDatabaseWrapper.php index 485d8d2f..6e50f07e 100644 --- a/inc/classes/main/database/frontend/class_PaymentsDatabaseWrapper.php +++ b/inc/classes/main/database/frontend/class_PaymentsDatabaseWrapper.php @@ -7,6 +7,7 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org + * @todo Add missing own interface for public methods * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class PaymentsDatabaseWrapper extends BaseDatabaseWrapper { +class PaymentsDatabaseWrapper extends BaseDatabaseWrapper implements Registerable { // Constants for exceptions const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180; diff --git a/inc/classes/main/database/frontend/class_UserDatabaseWrapper.php b/inc/classes/main/database/frontend/class_UserDatabaseWrapper.php index 16bce71d..263a0e87 100644 --- a/inc/classes/main/database/frontend/class_UserDatabaseWrapper.php +++ b/inc/classes/main/database/frontend/class_UserDatabaseWrapper.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class UserDatabaseWrapper extends BaseDatabaseWrapper implements ManageableAccountWrapper { +class UserDatabaseWrapper extends BaseDatabaseWrapper implements ManageableAccountWrapper, Registerable { // Constants for exceptions const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180; diff --git a/inc/classes/main/database/frontend/class_UserPointsDatabaseWrapper.php b/inc/classes/main/database/frontend/class_UserPointsDatabaseWrapper.php index 2431b9f9..18eef5b9 100644 --- a/inc/classes/main/database/frontend/class_UserPointsDatabaseWrapper.php +++ b/inc/classes/main/database/frontend/class_UserPointsDatabaseWrapper.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class UserPointsDatabaseWrapper extends BaseDatabaseWrapper implements BookablePointsWrapper { +class UserPointsDatabaseWrapper extends BaseDatabaseWrapper implements BookablePointsWrapper, Registerable { /** * Constants for database table names */ diff --git a/inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php b/inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php index 3484bc83..9785bef4 100644 --- a/inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php +++ b/inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php @@ -65,7 +65,7 @@ class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Regis $criteriaInstance->setLimit(1); // Get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('payment_db_wrapper_class'); + $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('payment_db_wrapper_class'); // Get result back $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance); diff --git a/inc/classes/main/points/class_UserPoints.php b/inc/classes/main/points/class_UserPoints.php index b28e2948..428868d8 100644 --- a/inc/classes/main/points/class_UserPoints.php +++ b/inc/classes/main/points/class_UserPoints.php @@ -58,7 +58,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo $searchInstance->setLimit(1); // Get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_points_db_wrapper_class'); + $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('user_points_db_wrapper_class'); // Get result back $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance); diff --git a/inc/classes/main/reader/class_ConsoleNewsReader.php b/inc/classes/main/reader/class_ConsoleNewsReader.php index 9f5cc8e5..1aa4b615 100644 --- a/inc/classes/main/reader/class_ConsoleNewsReader.php +++ b/inc/classes/main/reader/class_ConsoleNewsReader.php @@ -60,7 +60,7 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg $command = $this->getRequestInstance()->getRequestElement('command'); // First get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('news_db_wrapper_class'); + $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('news_db_wrapper_class'); // Next create a searchable criteria instance $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); diff --git a/inc/classes/main/reader/class_DefaultNewsReader.php b/inc/classes/main/reader/class_DefaultNewsReader.php index 8ff4a9b4..95354828 100644 --- a/inc/classes/main/reader/class_DefaultNewsReader.php +++ b/inc/classes/main/reader/class_DefaultNewsReader.php @@ -60,7 +60,7 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg $command = $this->getRequestInstance()->getRequestElement('command'); // First get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('news_db_wrapper_class'); + $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('news_db_wrapper_class'); // Next create a searchable criteria instance $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); -- 2.30.2