/**
* A set of data storeable in databases
*
- * @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.shipsimu.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
/**
* Table name
*/
- private $tableName = "";
-
- /**
- * Table columns (criteria) to store
- */
- private $tableColumns = array();
+ private $tableName = '';
/**
* Unique key
*/
- private $uniqueKey = "";
+ private $uniqueKey = '';
/**
* Primary key
*/
- private $primaryKey = "";
+ private $primaryKey = '';
/**
* Protected constructor
*
* @return void
*/
- protected function __construct() {
+ protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
* @param $tableName Name of the table
* @return $criteriaInstance An instance of this criteria
*/
- public final static function createDataSetCriteria ($tableName) {
+ public static final function createDataSetCriteria ($tableName) {
// Get a new instance
$criteriaInstance = new DataSetCriteria();
return $criteriaInstance;
}
- /**
- * Add criteria
- *
- * @param $criteriaKey Criteria key
- * @param $criteriaValue Criteria value
- * @return void
- */
- public function addCriteria ($criteriaKey, $criteriaValue) {
- $this->tableColumns[(string) $criteriaKey] = $criteriaValue;
- }
-
- /**
- * Add configured criteria
- *
- * @param $criteriaKey Criteria key
- * @param $configEntry Configuration entry
- * @return void
- */
- public function addConfiguredCriteria ($criteriaKey, $configEntry) {
- // Add configuration entry as criteria
- $value = $this->getConfigInstance()->readConfig($configEntry);
- $this->addCriteria($criteriaKey, $value);
- }
-
/**
* Setter for table name
*
* @return $uniqueValue Value of the unique key
*/
public final function getUniqueValue () {
- return $this->tableColumns[$this->getUniqueKey()];
- }
-
- /**
- * Getter for criteria array
- *
- * @return $tableColumns
- */
- public final function getCriteriaArray () {
- return $this->tableColumns;
+ return $this->getCriteriaElemnent($this->getUniqueKey());
}
/**