From 59e1674116910d2f89b97470ed5a3a1650aec99b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 8 Feb 2013 17:24:41 +0000 Subject: [PATCH] Added optional $requestInstance parameter --- .../extended/class_AddableCriteria.php | 40 ++----------------- .../wrapper/class_UserDatabaseWrapper.php | 4 +- .../class_UserPointsDatabaseWrapper.php | 4 +- inc/classes/main/points/class_UserPoints.php | 5 ++- .../main/result/class_DatabaseResult.php | 5 ++- 5 files changed, 13 insertions(+), 45 deletions(-) diff --git a/inc/classes/interfaces/criteria/extended/class_AddableCriteria.php b/inc/classes/interfaces/criteria/extended/class_AddableCriteria.php index fd6e6853..c98cad3f 100644 --- a/inc/classes/interfaces/criteria/extended/class_AddableCriteria.php +++ b/inc/classes/interfaces/criteria/extended/class_AddableCriteria.php @@ -25,45 +25,11 @@ interface Addable extends FrameworkInterface { /** * Adds registration elements to a given dataset instance * - * @param $criteriaInstance An instance of a storeable criteria + * @param $criteriaInstance An instance of a StoreableCriteria class + * @param $requestInstance An instance of a Requestable class * @return void */ - function addElementsToDataSet (StoreableCriteria $criteriaInstance); -} - -// [EOF] -?> - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface Addable extends FrameworkInterface { - /** - * Adds registration elements to a given dataset instance - * - * @param $criteriaInstance An instance of a storeable criteria - * @return void - */ - function addElementsToDataSet (StoreableCriteria $criteriaInstance); + function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance = NULL); } // [EOF] diff --git a/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php b/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php index c306eecb..322d5fdf 100644 --- a/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php +++ b/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php @@ -75,7 +75,7 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper implements ManageableAccou $dataSetInstance->setUniqueKey(self::DB_COLUMN_USERNAME); // Add registration elements to the dataset - $registrationInstance->addElementsToDataSet($dataSetInstance); + $registrationInstance->addElementsToDataSet($dataSetInstance, NULL); // "Insert" this request instance completely into the database $this->queryInsertDataSet($dataSetInstance); @@ -123,7 +123,7 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper implements ManageableAccou $dataSetInstance->setUniqueKey(self::DB_COLUMN_USERNAME); // Add all update criteria to the database set - $resultInstance->addElementsToDataSet($dataSetInstance); + $resultInstance->addElementsToDataSet($dataSetInstance, NULL); // "Update" this request with the database $this->getDatabaseInstance()->queryUpdateDataSet($dataSetInstance); diff --git a/inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php b/inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php index eb2a985c..0af3866c 100644 --- a/inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php +++ b/inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php @@ -77,7 +77,7 @@ class UserPointsDatabaseWrapper extends BaseDatabaseWrapper implements BookableP $dataSetInstance->setUniqueKey(self::DB_COLUMN_POINTS_UID); // Add registration elements to the dataset - $pointsInstance->addElementsToDataSet($dataSetInstance); + $pointsInstance->addElementsToDataSet($dataSetInstance, NULL); // "Insert" this request instance completely into the database $this->queryInsertDataSet($dataSetInstance); @@ -94,7 +94,7 @@ class UserPointsDatabaseWrapper extends BaseDatabaseWrapper implements BookableP $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER_POINTS)); // Add all update criteria to the database set - $resultInstance->addElementsToDataSet($dataSetInstance); + $resultInstance->addElementsToDataSet($dataSetInstance, NULL); // Add seach criteria $dataSetInstance->setSearchInstance($resultInstance->getUpdateInstance()->getSearchInstance()); diff --git a/inc/classes/main/points/class_UserPoints.php b/inc/classes/main/points/class_UserPoints.php index b9f9d125..13b210eb 100644 --- a/inc/classes/main/points/class_UserPoints.php +++ b/inc/classes/main/points/class_UserPoints.php @@ -166,10 +166,11 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo /** * Adds registration elements to a given dataset instance * - * @param $criteriaInstance An instance of a storeable criteria + * @param $criteriaInstance An instance of a StoreableCriteria class + * @param $requestInstance An instance of a Requestable class * @return void */ - public function addElementsToDataSet (StoreableCriteria $criteriaInstance) { + public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance = NULL) { // Add user id $criteriaInstance->addCriteria(UserPointsDatabaseWrapper::DB_COLUMN_POINTS_UID, $this->getUserInstance()->getUserId()); diff --git a/inc/classes/main/result/class_DatabaseResult.php b/inc/classes/main/result/class_DatabaseResult.php index dd215939..f143a540 100644 --- a/inc/classes/main/result/class_DatabaseResult.php +++ b/inc/classes/main/result/class_DatabaseResult.php @@ -318,10 +318,11 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up /** * Adds registration elements to a given dataset instance * - * @param $criteriaInstance An instance of a storeable criteria + * @param $criteriaInstance An instance of a StoreableCriteria class + * @param $requestInstance An instance of a Requestable class * @return void */ - public function addElementsToDataSet (StoreableCriteria $criteriaInstance) { + public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance = NULL) { // Walk only through out-dated columns foreach ($this->outDated as $key => $dummy) { // Does this key exist? -- 2.39.5