+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
use Org\Mxchange\City\Factory\Manager\ManagerFactory;
use Org\Mxchange\City\Factory\State\CityStateFactory;
use Org\Mxchange\City\Generic\BaseCitySystem;
-use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper;
+use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Criteria\Add\AddableCriteria;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
use Org\Mxchange\CoreFramework\Database\Updateable;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait;
+use Org\Mxchange\CoreFramework\Traits\Database\Frontend\DatabaseFrontendTrait;
/**
* A general City class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, AddableCriteria {
+ // Load traits
+ use CryptoTrait;
+ use DatabaseFrontendTrait;
+
/**
* City types
*/
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
- // Get a wrapper instance
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
+ // Get a frontend instance
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_info_db_frontend_class');
// Set it here
- $this->setWrapperInstance($wrapperInstance);
+ $this->setFrontendInstance($frontendInstance);
// Get a crypto instance
$cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
assert($requestInstance instanceof Requestable);
// Add City number and type
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID , 1);
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode'));
+ $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID , 1);
+ $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode'));
// Add the City id
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID, $this->getCityId());
+ $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID, $this->getCityId());
}
/**
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Add search criteria
- $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+ $searchInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName());
$searchInstance->setLimit(1);
// Now get another criteria
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);
- // Set wrapper class name
- $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
+ // Set frontend class name
+ $updateInstance->setFrontendConfigEntry('user_db_frontend_class');
// Remember the update in database result
$this->getResultInstance()->add2UpdateQueue($updateInstance);
*/
public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $cityData) {
// Add all data the array provides
- foreach (CityInformationDatabaseWrapper::getAllElements() as $element) {
+ foreach (CityInformationDatabaseFrontend::getAllElements() as $element) {
// Is the element there?
if (isset($cityData[$element])) {
// Add it
+++ /dev/null
-Deny from all
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
}
// Set username
- $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USERNAME));
+ $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseFrontend::DB_COLUMN_USERNAME));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
$hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
// Update the user class
- $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString);
+ $userInstance->updateDatabaseField(UserDatabaseFrontend::DB_COLUMN_CONFIRM_HASH, $hashedString);
// Re-set config entry to mailer engine
FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('html_template_class', FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('mail_template_class'));
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Information;
+
+// Import application-specific stuff
+use Org\Mxchange\City\Daemon\BaseCityDaemon;
+use Org\Mxchange\City\Factory\Manager\ManagerFactory;
+use Org\Mxchange\City\Helper\CityHelper;
+use Org\Mxchange\City\Manager\City\ManageableCity;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Request\Requestable;
+
+/**
+ * A database frontend for city informations
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+class CityInformationDatabaseFrontend extends BaseDatabaseFrontend implements CityInformationFrontend, Registerable {
+ // Constants for database table names
+ const DB_TABLE_CITY_INFORMATION = 'city_data';
+
+ // Constants for database column names
+ const DB_COLUMN_CITY_ID = 'city_id';
+ const DB_COLUMN_CITY_MODE = 'city_mode';
+ const DB_COLUMN_CITY_NAME = 'city_name';
+ const DB_COLUMN_CITY_USER_ID = 'city_user_id';
+ const DB_COLUMN_CITY_REGION_ID = 'city_region_id';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database frontend by a provided user class
+ *
+ * @return $frontendInstance An instance of the created frontend class
+ */
+ public static final function createCityInformationDatabaseFrontend () {
+ // Get a new instance
+ $frontendInstance = new CityInformationDatabaseFrontend();
+
+ // Set (primary!) table name
+ $frontendInstance->setTableName(self::DB_TABLE_CITY_INFORMATION);
+
+ // Return the instance
+ return $frontendInstance;
+ }
+
+ /**
+ * Checks whether there is an entry for given city instance
+ *
+ * @param $cityInstance An instance of a CityHelper class
+ * @return $isFound Whether a city id has been found for this city
+ */
+ public function ifCityDataIsFound (CityHelper $cityInstance) {
+ // Now get a search criteria instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Search for the city number one which is hard-coded the default
+ $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID , 1);
+ $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_MODE, $cityInstance->getRequestInstance()->getRequestElement('mode'));
+ $searchInstance->setLimit(1);
+
+ // Get a result back
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Set result instance in city instance
+ $cityInstance->setResultInstance($resultInstance);
+
+ // Is it valid?
+ $isFound = $resultInstance->next();
+
+ // Return it
+ return $isFound;
+ }
+
+ /**
+ * 'Registers' a new city id along with data provided in the city instance.
+ * This may sound confusing but avoids double code very nicely...
+ *
+ * @param $cityInstance A city instance
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance) {
+ // Get a dataset instance
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION));
+
+ // Set the primary key
+ $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID);
+
+ // Add registration elements to the dataset
+ $cityInstance->addElementsToDataSet($dataSetInstance, $requestInstance);
+
+ // "Insert" this dataset instance completely into the database
+ $this->queryInsertDataSet($dataSetInstance);
+ }
+
+ /**
+ * Removes non-public data from given array.
+ *
+ * @param $data An array with possible non-public data that needs to be removed.
+ * @return $data A cleaned up array with only public data.
+ */
+ public function removeNonPublicDataFromArray(array $data) {
+ // Currently call only inner method
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...');
+ $data = parent::removeNonPublicDataFromArray($data);
+
+ // Return cleaned data
+ return $data;
+ }
+
+ /**
+ * Checks whether the user has already founded a city
+ *
+ * @return $hasFounded Whether the user has already founded a city
+ */
+ public function ifUserHasFoundedCity () {
+ // Get user instance
+ $userInstance = GenericRegistry::getRegistry()->getInstance('user');
+
+ // Now get a search criteria instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Search for user's cities
+ $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_USER_ID, $userInstance->getUserId());
+
+ // Get a result back
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Get city manager instance
+ $managerInstance = ManagerFactory::createManagerByType('city');
+
+ // Make sure the manager instance is valid
+ assert($managerInstance instanceof ManageableCity);
+
+ // Set result instance
+ $managerInstance->setResultInstance($resultInstance);
+
+ // Has it been founded?
+ $hasFounded = $resultInstance->next();
+
+ // Return result
+ return $hasFounded;
+ }
+
+ /**
+ * Checks whether the given city name is taken
+ *
+ * @para $cityName Name of city
+ * @return $isTaken Whether the given city name is taken
+ */
+ public function ifCityExists (string $cityName) {
+ // Now get a search criteria instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Search for the city number one which is hard-coded the default
+ $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME, $cityName);
+ $searchInstance->setLimit(1);
+
+ // Get a result back
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Check it
+ $isTaken = $resultInstance->valid();
+
+ // Get manger instance
+ $managerInstance = ManagerFactory::createManagerByType('city');
+
+ // Make sure the instance is valid
+ assert($managerInstance instanceof ManageableCity);
+
+ // Set result instance
+ $managerInstance->setResultInstance($resultInstance);
+
+ // Return result
+ return $isTaken;
+ }
+
+ /**
+ * Creates a city from given request
+ *
+ * @para $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function createCityByRequest (Requestable $requestInstance) {
+ // Make sure all required fields are there
+ assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_NAME));
+ assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_REGION_ID));
+
+ // Get city name (to save some calls)
+ $cityName = $requestInstance->getRequestElement(self::DB_COLUMN_CITY_NAME);
+
+ // Make sure the city name is not taken yet
+ assert(!$this->ifCityExists($cityName));
+
+ // Get user instance
+ $userInstance = GenericRegistry::getRegistry()->getInstance('user');
+
+ // Get a dataset instance
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION));
+
+ // Set the primary key
+ $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID);
+
+ // Add city name and assign user id
+ $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , ($this->countTotalRows() + 1));
+ $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_NAME , $cityName);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_USER_ID , $userInstance->getUserId());
+ $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_REGION_ID, $requestInstance->getRequestElement(self::DB_COLUMN_CITY_REGION_ID));
+
+ // "Insert" this dataset instance completely into the database
+ $this->queryInsertDataSet($dataSetInstance);
+
+ // Post-check name
+ assert($this->ifCityExists($cityName));
+ }
+
+ /**
+ * Getter for all city ids as an array
+ *
+ * @return $cityIds All city ids as an array
+ */
+ public function getAllCityIds () {
+ // Init empty search instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // And run it on the database
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Init array
+ $cityIds = array();
+
+ // Anything found?
+ if ($resultInstance->count() == 0) {
+ // Nothing found
+ return $cityIds;
+ } // END - if
+
+ // Now get all 'city_id' columns
+ while ($resultInstance->next()) {
+ // Get current entry
+ $current = $resultInstance->current();
+
+ // 'city_id' should be there
+ assert(isset($current[self::DB_COLUMN_CITY_ID]));
+
+ // Add it to the array
+ array_push($cityIds, $current[self::DB_COLUMN_CITY_ID]);
+ } // END - while
+
+ // Return result
+ return $cityIds;
+ }
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Information;
-
-// Import application-specific stuff
-use Org\Mxchange\City\Daemon\BaseCityDaemon;
-use Org\Mxchange\City\Factory\Manager\ManagerFactory;
-use Org\Mxchange\City\Helper\CityHelper;
-use Org\Mxchange\City\Manager\City\ManageableCity;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Request\Requestable;
-
-/**
- * A database wrapper for city informations
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-class CityInformationDatabaseWrapper extends BaseDatabaseWrapper implements CityInformationWrapper, Registerable {
- // Constants for database table names
- const DB_TABLE_CITY_INFORMATION = 'city_data';
-
- // Constants for database column names
- const DB_COLUMN_CITY_ID = 'city_id';
- const DB_COLUMN_CITY_MODE = 'city_mode';
- const DB_COLUMN_CITY_NAME = 'city_name';
- const DB_COLUMN_CITY_USER_ID = 'city_user_id';
- const DB_COLUMN_CITY_REGION_ID = 'city_region_id';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this database wrapper by a provided user class
- *
- * @return $wrapperInstance An instance of the created wrapper class
- */
- public static final function createCityInformationDatabaseWrapper () {
- // Get a new instance
- $wrapperInstance = new CityInformationDatabaseWrapper();
-
- // Set (primary!) table name
- $wrapperInstance->setTableName(self::DB_TABLE_CITY_INFORMATION);
-
- // Return the instance
- return $wrapperInstance;
- }
-
- /**
- * Checks whether there is an entry for given city instance
- *
- * @param $cityInstance An instance of a CityHelper class
- * @return $isFound Whether a city id has been found for this city
- */
- public function ifCityDataIsFound (CityHelper $cityInstance) {
- // Now get a search criteria instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // Search for the city number one which is hard-coded the default
- $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID , 1);
- $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $cityInstance->getRequestInstance()->getRequestElement('mode'));
- $searchInstance->setLimit(1);
-
- // Get a result back
- $resultInstance = $this->doSelectByCriteria($searchInstance);
-
- // Set result instance in city instance
- $cityInstance->setResultInstance($resultInstance);
-
- // Is it valid?
- $isFound = $resultInstance->next();
-
- // Return it
- return $isFound;
- }
-
- /**
- * 'Registers' a new city id along with data provided in the city instance.
- * This may sound confusing but avoids double code very nicely...
- *
- * @param $cityInstance A city instance
- * @param $requestInstance An instance of a Requestable class
- * @return void
- */
- public function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance) {
- // Get a dataset instance
- $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION));
-
- // Set the primary key
- $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID);
-
- // Add registration elements to the dataset
- $cityInstance->addElementsToDataSet($dataSetInstance, $requestInstance);
-
- // "Insert" this dataset instance completely into the database
- $this->queryInsertDataSet($dataSetInstance);
- }
-
- /**
- * Removes non-public data from given array.
- *
- * @param $data An array with possible non-public data that needs to be removed.
- * @return $data A cleaned up array with only public data.
- */
- public function removeNonPublicDataFromArray(array $data) {
- // Currently call only inner method
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...');
- $data = parent::removeNonPublicDataFromArray($data);
-
- // Return cleaned data
- return $data;
- }
-
- /**
- * Checks whether the user has already founded a city
- *
- * @return $hasFounded Whether the user has already founded a city
- */
- public function ifUserHasFoundedCity () {
- // Get user instance
- $userInstance = GenericRegistry::getRegistry()->getInstance('user');
-
- // Now get a search criteria instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // Search for user's cities
- $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_USER_ID, $userInstance->getUserId());
-
- // Get a result back
- $resultInstance = $this->doSelectByCriteria($searchInstance);
-
- // Get city manager instance
- $managerInstance = ManagerFactory::createManagerByType('city');
-
- // Make sure the manager instance is valid
- assert($managerInstance instanceof ManageableCity);
-
- // Set result instance
- $managerInstance->setResultInstance($resultInstance);
-
- // Has it been founded?
- $hasFounded = $resultInstance->next();
-
- // Return result
- return $hasFounded;
- }
-
- /**
- * Checks whether the given city name is taken
- *
- * @para $cityName Name of city
- * @return $isTaken Whether the given city name is taken
- */
- public function ifCityExists ($cityName) {
- // Now get a search criteria instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // Search for the city number one which is hard-coded the default
- $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME, $cityName);
- $searchInstance->setLimit(1);
-
- // Get a result back
- $resultInstance = $this->doSelectByCriteria($searchInstance);
-
- // Check it
- $isTaken = $resultInstance->valid();
-
- // Get manger instance
- $managerInstance = ManagerFactory::createManagerByType('city');
-
- // Make sure the instance is valid
- assert($managerInstance instanceof ManageableCity);
-
- // Set result instance
- $managerInstance->setResultInstance($resultInstance);
-
- // Return result
- return $isTaken;
- }
-
- /**
- * Creates a city from given request
- *
- * @para $requestInstance An instance of a Requestable class
- * @return void
- */
- public function createCityByRequest (Requestable $requestInstance) {
- // Make sure all required fields are there
- assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_NAME));
- assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_REGION_ID));
-
- // Get city name (to save some calls)
- $cityName = $requestInstance->getRequestElement(self::DB_COLUMN_CITY_NAME);
-
- // Make sure the city name is not taken yet
- assert(!$this->ifCityExists($cityName));
-
- // Get user instance
- $userInstance = GenericRegistry::getRegistry()->getInstance('user');
-
- // Get a dataset instance
- $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION));
-
- // Set the primary key
- $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID);
-
- // Add city name and assign user id
- $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , ($this->countTotalRows() + 1));
- $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_NAME , $cityName);
- $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_USER_ID , $userInstance->getUserId());
- $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_REGION_ID, $requestInstance->getRequestElement(self::DB_COLUMN_CITY_REGION_ID));
-
- // "Insert" this dataset instance completely into the database
- $this->queryInsertDataSet($dataSetInstance);
-
- // Post-check name
- assert($this->ifCityExists($cityName));
- }
-
- /**
- * Getter for all city ids as an array
- *
- * @return $cityIds All city ids as an array
- */
- public function getAllCityIds () {
- // Init empty search instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // And run it on the database
- $resultInstance = $this->doSelectByCriteria($searchInstance);
-
- // Init array
- $cityIds = array();
-
- // Anything found?
- if ($resultInstance->count() == 0) {
- // Nothing found
- return $cityIds;
- } // END - if
-
- // Now get all 'city_id' columns
- while ($resultInstance->next()) {
- // Get current entry
- $current = $resultInstance->current();
-
- // 'city_id' should be there
- assert(isset($current[self::DB_COLUMN_CITY_ID]));
-
- // Add it to the array
- array_push($cityIds, $current[self::DB_COLUMN_CITY_ID]);
- } // END - while
-
- // Return result
- return $cityIds;
- }
-}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Districts;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+
+/**
+ * A database frontend for city districts
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+class CityDistrictsDatabaseFrontend extends BaseDatabaseFrontend implements CityDistrictsFrontend, Registerable {
+ // Constants for database table names
+ const DB_TABLE_CITY_DISTRICTS = 'city_districts';
+
+ // Section id, an referenced city id and district id
+ const DB_COLUMN_CITY_ID = 'city_id';
+ const DB_COLUMN_DISTRICT_ID = 'district_id';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database frontend by a provided user class
+ *
+ * @return $frontendInstance An instance of the created frontend class
+ */
+ public static final function createCityDistrictsDatabaseFrontend () {
+ // Get a new instance
+ $frontendInstance = new CityDistrictsDatabaseFrontend();
+
+ // Set (primary!) table name
+ $frontendInstance->setTableName(self::DB_TABLE_CITY_DISTRICTS);
+
+ // Return the instance
+ return $frontendInstance;
+ }
+
+ /**
+ * Checks if the given city id is found in districts table
+ *
+ * @param $cityId City id to check
+ * @return $isFound Whether the city id is found
+ */
+ public function ifCityHasDistricts (int $cityId) {
+ // Get search instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Search for 'city_id'
+ $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
+
+ /*
+ * Only one entry is enough to find, else this query could run very
+ * long on large maps.
+ */
+ $searchInstance->setLimit(1);
+
+ // Execute it on database instance
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Check if there is one entry
+ $isFound = $resultInstance->next();
+
+ // Return result
+ return $isFound;
+ }
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Districts;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-
-/**
- * A database wrapper for city districts
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-class CityDistrictsDatabaseWrapper extends BaseDatabaseWrapper implements CityDistrictsWrapper, Registerable {
- // Constants for database table names
- const DB_TABLE_CITY_DISTRICTS = 'city_districts';
-
- // Section id, an referenced city id and district id
- const DB_COLUMN_CITY_ID = 'city_id';
- const DB_COLUMN_DISTRICT_ID = 'district_id';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this database wrapper by a provided user class
- *
- * @return $wrapperInstance An instance of the created wrapper class
- */
- public static final function createCityDistrictsDatabaseWrapper () {
- // Get a new instance
- $wrapperInstance = new CityDistrictsDatabaseWrapper();
-
- // Set (primary!) table name
- $wrapperInstance->setTableName(self::DB_TABLE_CITY_DISTRICTS);
-
- // Return the instance
- return $wrapperInstance;
- }
-
- /**
- * Checks if the given city id is found in districts table
- *
- * @param $cityId City id to check
- * @return $isFound Whether the city id is found
- */
- public function ifCityHasDistricts ($cityId) {
- // Get search instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // Search for 'city_id'
- $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
-
- /*
- * Only one entry is enough to find, else this query could run very
- * long on large maps.
- */
- $searchInstance->setLimit(1);
-
- // Execute it on database instance
- $resultInstance = $this->doSelectByCriteria($searchInstance);
-
- // Check if there is one entry
- $isFound = $resultInstance->next();
-
- // Return result
- return $isFound;
- }
-}
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Lots;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+
+/**
+ * A database frontend for city lots
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+class CityLotsDatabaseFrontend extends BaseDatabaseFrontend implements CityLotsFrontend, Registerable {
+ // Constants for database table names
+ const DB_TABLE_CITY_LOTS = 'city_lots';
+
+ // Section id, an referenced city id and lot id
+ const DB_COLUMN_CITY_ID = 'city_id';
+ const DB_COLUMN_LOT_ID = 'lot_id';
+ const DB_COLUMN_DISTRICT_ID = 'district_id';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database frontend by a provided user class
+ *
+ * @return $frontendInstance An instance of the created frontend class
+ */
+ public static final function createCityLotsDatabaseFrontend () {
+ // Get a new instance
+ $frontendInstance = new CityLotsDatabaseFrontend();
+
+ // Set (primary!) table name
+ $frontendInstance->setTableName(self::DB_TABLE_CITY_LOTS);
+
+ // Return the instance
+ return $frontendInstance;
+ }
+
+ /**
+ * Checks if the given city id is found in lots table
+ *
+ * @param $cityId City id to check
+ * @return $isFound Whether the city id is found
+ */
+ public function ifCityHasLots (int $cityId) {
+ // Get search instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Search for 'city_id'
+ $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
+
+ /*
+ * Only one entry is enough to find, else this query could run very
+ * long on large maps.
+ */
+ $searchInstance->setLimit(1);
+
+ // Execute it on database instance
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Check if there is one entry
+ $isFound = $resultInstance->next();
+
+ // Return result
+ return $isFound;
+ }
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Lots;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-
-/**
- * A database wrapper for city lots
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-class CityLotsDatabaseWrapper extends BaseDatabaseWrapper implements CityLotsWrapper, Registerable {
- // Constants for database table names
- const DB_TABLE_CITY_LOTS = 'city_lots';
-
- // Section id, an referenced city id and lot id
- const DB_COLUMN_CITY_ID = 'city_id';
- const DB_COLUMN_LOT_ID = 'lot_id';
- const DB_COLUMN_DISTRICT_ID = 'district_id';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this database wrapper by a provided user class
- *
- * @return $wrapperInstance An instance of the created wrapper class
- */
- public static final function createCityLotsDatabaseWrapper () {
- // Get a new instance
- $wrapperInstance = new CityLotsDatabaseWrapper();
-
- // Set (primary!) table name
- $wrapperInstance->setTableName(self::DB_TABLE_CITY_LOTS);
-
- // Return the instance
- return $wrapperInstance;
- }
-
- /**
- * Checks if the given city id is found in lots table
- *
- * @param $cityId City id to check
- * @return $isFound Whether the city id is found
- */
- public function ifCityHasLots ($cityId) {
- // Get search instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // Search for 'city_id'
- $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
-
- /*
- * Only one entry is enough to find, else this query could run very
- * long on large maps.
- */
- $searchInstance->setLimit(1);
-
- // Execute it on database instance
- $resultInstance = $this->doSelectByCriteria($searchInstance);
-
- // Check if there is one entry
- $isFound = $resultInstance->next();
-
- // Return result
- return $isFound;
- }
-}
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Sections;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+
+/**
+ * A database frontend for city sections. Sections are the smalles entity of a
+ * city. They can be connected with each other and form a lot. Therefore only
+ * sections of same type (and sub type) can be linked combined, else you will
+ * something really strange, a residential building with some industry parts
+ * for example is not possible in real world.
+ *
+ * Sure you can have a small shop (commercial) on ground level and some
+ * residentials on higher levels. This city simulation does support such
+ * creations as the levels (Z axis) is different.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+class CitySectionsDatabaseFrontend extends BaseDatabaseFrontend implements CitySectionsFrontend, Registerable {
+ // Constants for database table names
+ const DB_TABLE_CITY_SECTIONS = 'city_sections';
+
+ // Entry id
+ const DB_COLUMN_ENTRY_ID = 'entry_id';
+
+ // Section id, an referenced city id and lot id
+ const DB_COLUMN_SECTION_ID = 'city_section_id';
+ const DB_COLUMN_CITY_ID = 'city_id';
+
+ /*
+ * Lot id, the lot id is only set if the player has "aquired" the sections
+ * and has created a lot based on these sections.
+ */
+ const DB_COLUMN_LOT_ID = 'lot_id';
+
+ // Section and sub type (e.g. residential, hut)
+ const DB_COLUMN_SECTION_TYPE = 'section_type';
+ const DB_COLUMN_SECTION_SUB_TYPE = 'section_sub_type';
+
+ // X-Y-Z position
+ const DB_COLUMN_SECTION_POSITION_X = 'section_position_x';
+ const DB_COLUMN_SECTION_POSITION_Y = 'section_position_y';
+ const DB_COLUMN_SECTION_POSITION_Z = 'section_position_z';
+
+ // Connected neigbouring sections
+ const DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID = 'section_neighbour_west_id';
+ const DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID = 'section_neighbour_east_id';
+ const DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID = 'section_neighbour_north_id';
+ const DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID = 'section_neighbour_south_id';
+ const DB_COLUMN_SECTION_NEIGHBOUR_UP_ID = 'section_neighbour_up_id';
+ const DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID = 'section_neighbour_down_id';
+
+ // Other settings:
+ // Reserved section (see documentation)
+ const DB_COLUMN_SECTION_RESERVED = 'section_reserved';
+
+ // Section types
+ // @TODO "water" is not yet supported and may end up in a very random land.
+ const SECTION_TYPE_WATER = 'water';
+ const SECTION_TYPE_EMPTY_LAND = 'land';
+ const SECTION_TYPE_AIR = 'air';
+
+ // Sub sections
+ // @TODO All types of water are not supported yet.
+ const SECTION_SUB_TYPE_GRASS = 'grass';
+ const SECTION_SUB_TYPE_AIR = 'air';
+
+ // Reserved flag
+ const IS_NOT_RESERVED = 0;
+ const IS_RESERVED = 1;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database frontend by a provided user class
+ *
+ * @return $frontendInstance An instance of the created frontend class
+ */
+ public static final function createCitySectionsDatabaseFrontend () {
+ // Get a new instance
+ $frontendInstance = new CitySectionsDatabaseFrontend();
+
+ // Set (primary!) table name
+ $frontendInstance->setTableName(self::DB_TABLE_CITY_SECTIONS);
+
+ // Return the instance
+ return $frontendInstance;
+ }
+
+ /**
+ * Checks if the given city id is found in sections table
+ *
+ * @param $cityId City id to check
+ * @return $isFound Whether the city id is found
+ */
+ public function ifCityHasSections (int $cityId) {
+ // Get search instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Search for 'city_id'
+ $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
+
+ /*
+ * Only one entry is enough to find, else this query could run very
+ * long on large maps.
+ */
+ $searchInstance->setLimit(1);
+
+ // Execute it on database instance
+ $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+ // Check if there is one entry
+ $isFound = $resultInstance->next();
+
+ // Return result
+ return $isFound;
+ }
+
+ /**
+ * Expands the sections table with initial data for given city id
+ *
+ * @param $cityId City id to check
+ * @return $ids Sections ids from initial expansion
+ * @todo Add handling of water types to make a more cooler map
+ */
+ public function doInitialCityExpansion (int $cityId) {
+ // Make sure this city has no sections
+ assert(!$this->ifCityHasSections($cityId));
+
+ /*
+ * "Cache" max "radius" for initial city expansion. It is not a real
+ * radius but more a max expansion area (expand +- half of "radius"
+ * from 0/0). The "zero point" is always calculated in.
+ *
+ * This gives a maxium initial area calculated as follows:
+ *
+ * totalInitialSections = (radius + 1) * (radius + 1)
+ */
+ $radius = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_xy_expansion_radius');
+
+ // Max up and down ...
+ $maxUp = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_up_expansion');
+ $maxDown = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_down_expansion');
+
+ // Calculate total sections
+ $totalSections = (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1));
+
+ // Debug message:
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: radius=' . $radius . ',maxUp=' . $maxUp . ',maxDown=' . $maxDown . ',totalSections=' . $totalSections);
+
+ // Get data set instance
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_SECTIONS));
+
+ // Add values for "zero point"
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_ID , 1);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , $cityId);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_LOT_ID , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_TYPE , self::SECTION_TYPE_AIR);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , self::SECTION_SUB_TYPE_AIR);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_X , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Y , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Z , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID, 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID, 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_UP_ID , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID , 0);
+ $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_RESERVED , self::IS_NOT_RESERVED);
+
+ // Set primary key to 'city_id'/'section_id'
+ $dataSetInstance->setPrimaryKeyCombined(array(self::DB_COLUMN_CITY_ID, self::DB_COLUMN_SECTION_ID));
+
+ // Entry id for counting each entry
+ $dataSetInstance->setUniqueKey(self::DB_COLUMN_ENTRY_ID);
+
+ // Add "zero point"
+ $this->queryInsertDataSet($dataSetInstance);
+
+ // Set section id to 2 as 1 is already initialized + init array
+ $sections = array();
+
+ // Output message to ask for user's patience ...
+ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Writing ' . $totalSections . ' sections for city ' . $cityId . ' ... (this may takes some time)');
+
+ // Expand half of it to north/south (north=positive, south=negative)
+ for ($north = 1; $north < round($radius / 2); $north++) {
+ // Expand half of it to west/east (west=positive, east=negative)
+ for ($west = 1; $west < round($radius / 2); $west++) {
+ // Expand up/down (including "zero point")
+ for ($z = $maxDown; $z < ($maxUp + 1); $z++) {
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: north=' . $north . ',west=' . $west . ',z=' . $z);
+
+ // Fill array up with south/east/down ids
+ $sections[($north * -1)][($west * -1)][$z]['type'] = self::SECTION_TYPE_EMPTY_LAND;
+ $sections[($north * -1)][($west * -1)][$z]['sub'] = self::SECTION_SUB_TYPE_GRASS;
+
+ // Fill up array with north/west/up ids (only air)
+ $sections[$north][$west][$z]['type'] = self::SECTION_TYPE_AIR;
+ $sections[$north][$west][$z]['sub'] = self::SECTION_SUB_TYPE_AIR;
+ } // END - for
+ } // END - for
+ } // END - for
+
+ // Init section id with 2 as 1 is the "zero point"
+ $sectionId = 2;
+
+ // Loop through whole array again for writing it to database: north/south
+ foreach ($sections as $x => $sectionX) {
+ // Loop through west/east values
+ foreach ($sectionX as $y => $sectionY) {
+ // Loop through up/down values
+ foreach ($sectionY as $z => $sectionData) {
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ',z=' . $z . ',sectionId=' . $sectionId);
+
+ // Set all coordinates for positive directions
+ $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_ID , $sectionId);
+ $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_X, $x);
+ $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Y, $y);
+ $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Z, $z);
+ $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_TYPE , $sectionData['type']);
+ $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , $sectionData['sub']);
+
+ // Add value to database
+ $this->queryInsertDataSet($dataSetInstance);
+
+ // Count id up
+ $sectionId++;
+ } // END - foreach
+
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ' has been written.');
+ } // END - foreach
+
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ' has been written.');
+ } // END - foreach
+
+ // Thank you for waiting! :-)
+ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: A total of ' . $totalSections . ' sections has been written for city id ' . $cityId . '.');
+ }
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Sections;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-
-/**
- * A database wrapper for city sections. Sections are the smalles entity of a
- * city. They can be connected with each other and form a lot. Therefore only
- * sections of same type (and sub type) can be linked combined, else you will
- * something really strange, a residential building with some industry parts
- * for example is not possible in real world.
- *
- * Sure you can have a small shop (commercial) on ground level and some
- * residentials on higher levels. This city simulation does support such
- * creations as the levels (Z axis) is different.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-class CitySectionsDatabaseWrapper extends BaseDatabaseWrapper implements CitySectionsWrapper, Registerable {
- // Constants for database table names
- const DB_TABLE_CITY_SECTIONS = 'city_sections';
-
- // Entry id
- const DB_COLUMN_ENTRY_ID = 'entry_id';
-
- // Section id, an referenced city id and lot id
- const DB_COLUMN_SECTION_ID = 'city_section_id';
- const DB_COLUMN_CITY_ID = 'city_id';
-
- /*
- * Lot id, the lot id is only set if the player has "aquired" the sections
- * and has created a lot based on these sections.
- */
- const DB_COLUMN_LOT_ID = 'lot_id';
-
- // Section and sub type (e.g. residential, hut)
- const DB_COLUMN_SECTION_TYPE = 'section_type';
- const DB_COLUMN_SECTION_SUB_TYPE = 'section_sub_type';
-
- // X-Y-Z position
- const DB_COLUMN_SECTION_POSITION_X = 'section_position_x';
- const DB_COLUMN_SECTION_POSITION_Y = 'section_position_y';
- const DB_COLUMN_SECTION_POSITION_Z = 'section_position_z';
-
- // Connected neigbouring sections
- const DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID = 'section_neighbour_west_id';
- const DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID = 'section_neighbour_east_id';
- const DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID = 'section_neighbour_north_id';
- const DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID = 'section_neighbour_south_id';
- const DB_COLUMN_SECTION_NEIGHBOUR_UP_ID = 'section_neighbour_up_id';
- const DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID = 'section_neighbour_down_id';
-
- // Other settings:
- // Reserved section (see documentation)
- const DB_COLUMN_SECTION_RESERVED = 'section_reserved';
-
- // Section types
- // @TODO "water" is not yet supported and may end up in a very random land.
- const SECTION_TYPE_WATER = 'water';
- const SECTION_TYPE_EMPTY_LAND = 'land';
- const SECTION_TYPE_AIR = 'air';
-
- // Sub sections
- // @TODO All types of water are not supported yet.
- const SECTION_SUB_TYPE_GRASS = 'grass';
- const SECTION_SUB_TYPE_AIR = 'air';
-
- // Reserved flag
- const IS_NOT_RESERVED = 0;
- const IS_RESERVED = 1;
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this database wrapper by a provided user class
- *
- * @return $wrapperInstance An instance of the created wrapper class
- */
- public static final function createCitySectionsDatabaseWrapper () {
- // Get a new instance
- $wrapperInstance = new CitySectionsDatabaseWrapper();
-
- // Set (primary!) table name
- $wrapperInstance->setTableName(self::DB_TABLE_CITY_SECTIONS);
-
- // Return the instance
- return $wrapperInstance;
- }
-
- /**
- * Checks if the given city id is found in sections table
- *
- * @param $cityId City id to check
- * @return $isFound Whether the city id is found
- */
- public function ifCityHasSections ($cityId) {
- // Get search instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // Search for 'city_id'
- $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
-
- /*
- * Only one entry is enough to find, else this query could run very
- * long on large maps.
- */
- $searchInstance->setLimit(1);
-
- // Execute it on database instance
- $resultInstance = $this->doSelectByCriteria($searchInstance);
-
- // Check if there is one entry
- $isFound = $resultInstance->next();
-
- // Return result
- return $isFound;
- }
-
- /**
- * Expands the sections table with initial data for given city id
- *
- * @param $cityId City id to check
- * @return $ids Sections ids from initial expansion
- * @todo Add handling of water types to make a more cooler map
- */
- public function doInitialCityExpansion ($cityId) {
- // Make sure this city has no sections
- assert(!$this->ifCityHasSections($cityId));
-
- /*
- * "Cache" max "radius" for initial city expansion. It is not a real
- * radius but more a max expansion area (expand +- half of "radius"
- * from 0/0). The "zero point" is always calculated in.
- *
- * This gives a maxium initial area calculated as follows:
- *
- * totalInitialSections = (radius + 1) * (radius + 1)
- */
- $radius = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_xy_expansion_radius');
-
- // Max up and down ...
- $maxUp = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_up_expansion');
- $maxDown = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_down_expansion');
-
- // Calculate total sections
- $totalSections = (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1));
-
- // Debug message:
- /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: radius=' . $radius . ',maxUp=' . $maxUp . ',maxDown=' . $maxDown . ',totalSections=' . $totalSections);
-
- // Get data set instance
- $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_SECTIONS));
-
- // Add values for "zero point"
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_ID , 1);
- $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , $cityId);
- $dataSetInstance->addCriteria(self::DB_COLUMN_LOT_ID , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_TYPE , self::SECTION_TYPE_AIR);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , self::SECTION_SUB_TYPE_AIR);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_X , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Y , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Z , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID, 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID, 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_UP_ID , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID , 0);
- $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_RESERVED , self::IS_NOT_RESERVED);
-
- // Set primary key to 'city_id'/'section_id'
- $dataSetInstance->setPrimaryKeyCombined(array(self::DB_COLUMN_CITY_ID, self::DB_COLUMN_SECTION_ID));
-
- // Entry id for counting each entry
- $dataSetInstance->setUniqueKey(self::DB_COLUMN_ENTRY_ID);
-
- // Add "zero point"
- $this->queryInsertDataSet($dataSetInstance);
-
- // Set section id to 2 as 1 is already initialized + init array
- $sections = array();
-
- // Output message to ask for user's patience ...
- self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Writing ' . $totalSections . ' sections for city ' . $cityId . ' ... (this may takes some time)');
-
- // Expand half of it to north/south (north=positive, south=negative)
- for ($north = 1; $north < round($radius / 2); $north++) {
- // Expand half of it to west/east (west=positive, east=negative)
- for ($west = 1; $west < round($radius / 2); $west++) {
- // Expand up/down (including "zero point")
- for ($z = $maxDown; $z < ($maxUp + 1); $z++) {
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: north=' . $north . ',west=' . $west . ',z=' . $z);
-
- // Fill array up with south/east/down ids
- $sections[($north * -1)][($west * -1)][$z]['type'] = self::SECTION_TYPE_EMPTY_LAND;
- $sections[($north * -1)][($west * -1)][$z]['sub'] = self::SECTION_SUB_TYPE_GRASS;
-
- // Fill up array with north/west/up ids (only air)
- $sections[$north][$west][$z]['type'] = self::SECTION_TYPE_AIR;
- $sections[$north][$west][$z]['sub'] = self::SECTION_SUB_TYPE_AIR;
- } // END - for
- } // END - for
- } // END - for
-
- // Init section id with 2 as 1 is the "zero point"
- $sectionId = 2;
-
- // Loop through whole array again for writing it to database: north/south
- foreach ($sections as $x => $sectionX) {
- // Loop through west/east values
- foreach ($sectionX as $y => $sectionY) {
- // Loop through up/down values
- foreach ($sectionY as $z => $sectionData) {
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ',z=' . $z . ',sectionId=' . $sectionId);
-
- // Set all coordinates for positive directions
- $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_ID , $sectionId);
- $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_X, $x);
- $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Y, $y);
- $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Z, $z);
- $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_TYPE , $sectionData['type']);
- $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , $sectionData['sub']);
-
- // Add value to database
- $this->queryInsertDataSet($dataSetInstance);
-
- // Count id up
- $sectionId++;
- } // END - foreach
-
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ' has been written.');
- } // END - foreach
-
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ' has been written.');
- } // END - foreach
-
- // Thank you for waiting! :-)
- self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: A total of ' . $totalSections . ' sections has been written for city id ' . $cityId . '.');
- }
-}
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\GameOptions;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+
+/**
+ * A database frontend for game options
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+class CityGameOptionsDatabaseFrontend extends BaseDatabaseFrontend implements CityGameOptionsFrontend, Registerable {
+ // Constants for database table names
+ const DB_TABLE_GAME_OPTION_INFORMATION = 'game_options';
+
+ // Constants for database column names
+ const DB_COLUMN_GAME_OPTION_ID = 'game_id';
+ const DB_COLUMN_GAME_OPTION_USER_ID = 'game_user_id';
+ const DB_COLUMN_GAME_OPTION_FLAG_PAUSED = 'game_flag_paused';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database frontend by a provided user class
+ *
+ * @return $frontendInstance An instance of the created frontend class
+ */
+ public static final function createCityGameOptionsDatabaseFrontend () {
+ // Get a new instance
+ $frontendInstance = new CityGameOptionsDatabaseFrontend();
+
+ // Set (primary!) table name
+ $frontendInstance->setTableName(self::DB_TABLE_GAME_OPTION_INFORMATION);
+
+ // Return the instance
+ return $frontendInstance;
+ }
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\GameOptions;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-
-/**
- * A database wrapper for game options
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-class CityGameOptionsDatabaseWrapper extends BaseDatabaseWrapper implements CityGameOptionsWrapper, Registerable {
- // Constants for database table names
- const DB_TABLE_GAME_OPTION_INFORMATION = 'game_options';
-
- // Constants for database column names
- const DB_COLUMN_GAME_OPTION_ID = 'game_id';
- const DB_COLUMN_GAME_OPTION_USER_ID = 'game_user_id';
- const DB_COLUMN_GAME_OPTION_FLAG_PAUSED = 'game_flag_paused';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this database wrapper by a provided user class
- *
- * @return $wrapperInstance An instance of the created wrapper class
- */
- public static final function createCityGameOptionsDatabaseWrapper () {
- // Get a new instance
- $wrapperInstance = new CityGameOptionsDatabaseWrapper();
-
- // Set (primary!) table name
- $wrapperInstance->setTableName(self::DB_TABLE_GAME_OPTION_INFORMATION);
-
- // Return the instance
- return $wrapperInstance;
- }
-}
+++ /dev/null
-Deny from all
use Org\Mxchange\City\Factory\Manager\ManagerFactory;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/**
- * A database wrapper for region informations
+ * A database frontend for region informations
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class RegionInformationDatabaseWrapper extends BaseDatabaseWrapper implements RegionInformationWrapper, Registerable {
+class RegionInformationDatabaseFrontend extends BaseDatabaseFrontend implements RegionInformationFrontend, Registerable {
// Constants for database table names
const DB_TABLE_REGION_INFORMATION = 'region_data';
}
/**
- * Creates an instance of this database wrapper by a provided user class
+ * Creates an instance of this database frontend by a provided user class
*
- * @return $wrapperInstance An instance of the created wrapper class
+ * @return $frontendInstance An instance of the created frontend class
*/
- public static final function createRegionInformationDatabaseWrapper () {
+ public static final function createRegionInformationDatabaseFrontend () {
// Get a new instance
- $wrapperInstance = new RegionInformationDatabaseWrapper();
+ $frontendInstance = new RegionInformationDatabaseFrontend();
// Set (primary!) table name
- $wrapperInstance->setTableName(self::DB_TABLE_REGION_INFORMATION);
+ $frontendInstance->setTableName(self::DB_TABLE_REGION_INFORMATION);
// Return the instance
- return $wrapperInstance;
+ return $frontendInstance;
}
/**
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Search for user's cities
- $searchInstance->addCriteria(RegionInformationDatabaseWrapper::DB_COLUMN_REGION_USER_ID, $userInstance->getUserId());
+ $searchInstance->addCriteria(RegionInformationDatabaseFrontend::DB_COLUMN_REGION_USER_ID, $userInstance->getUserId());
// Get a result back
$resultInstance = $this->doSelectByCriteria($searchInstance);
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Search for the region number one which is hard-coded the default
- $searchInstance->addCriteria(RegionInformationDatabaseWrapper::DB_COLUMN_REGION_NAME, $regionName);
+ $searchInstance->addCriteria(RegionInformationDatabaseFrontend::DB_COLUMN_REGION_NAME, $regionName);
$searchInstance->setLimit(1);
// Get a result back
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Region;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+
+/**
+ * A database frontend for region maps
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+class RegionMapDatabaseFrontend extends BaseDatabaseFrontend implements RegionMapFrontend, Registerable {
+ // Constants for database table names
+ const DB_TABLE_REGION_MAP = 'region_map';
+
+ // Constants for database column names
+ const DB_COLUMN_REGION_ID = 'region_id';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database frontend by a provided user class
+ *
+ * @return $frontendInstance An instance of the created frontend class
+ */
+ public static final function createRegionMapDatabaseFrontend () {
+ // Get a new instance
+ $frontendInstance = new RegionMapDatabaseFrontend();
+
+ // Set (primary!) table name
+ $frontendInstance->setTableName(self::DB_TABLE_REGION_MAP);
+
+ // Return the instance
+ return $frontendInstance;
+ }
+
+ /**
+ * Removes non-public data from given array.
+ *
+ * @param $data An array with possible non-public data that needs to be removed.
+ * @return $data A cleaned up array with only public data.
+ */
+ public function removeNonPublicDataFromArray(array $data) {
+ // Currently call only inner method
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REGION-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...');
+ $data = parent::removeNonPublicDataFromArray($data);
+
+ // Return cleaned data
+ return $data;
+ }
+
+ /**
+ * Creates a region by given name
+ *
+ * @return void
+ */
+ public function createRegionByName () {
+ // Pre-check
+ die(__METHOD__ . ': Unfinshed!');
+ assert(!$this->ifRegionExists($regionName));
+
+ // Get user instance
+ $userInstance = GenericRegistry::getRegistry()->getInstance('user');
+
+ // Get a dataset instance
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_REGION_MAP));
+
+ // Set the primary key
+ $dataSetInstance->setUniqueKey(self::DB_COLUMN_REGION_ID);
+
+ // Add region name and assign user id
+ $dataSetInstance->addCriteria(self::DB_COLUMN_REGION_ID , ($this->countTotalRows() + 1));
+
+ // "Insert" this dataset instance completely into the database
+ $this->queryInsertDataSet($dataSetInstance);
+
+ // Post-check name
+ assert($this->ifRegionExists($regionName));
+ }
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Region;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-
-/**
- * A database wrapper for region maps
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-class RegionMapDatabaseWrapper extends BaseDatabaseWrapper implements RegionMapWrapper, Registerable {
- // Constants for database table names
- const DB_TABLE_REGION_MAP = 'region_map';
-
- // Constants for database column names
- const DB_COLUMN_REGION_ID = 'region_id';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this database wrapper by a provided user class
- *
- * @return $wrapperInstance An instance of the created wrapper class
- */
- public static final function createRegionMapDatabaseWrapper () {
- // Get a new instance
- $wrapperInstance = new RegionMapDatabaseWrapper();
-
- // Set (primary!) table name
- $wrapperInstance->setTableName(self::DB_TABLE_REGION_MAP);
-
- // Return the instance
- return $wrapperInstance;
- }
-
- /**
- * Removes non-public data from given array.
- *
- * @param $data An array with possible non-public data that needs to be removed.
- * @return $data A cleaned up array with only public data.
- */
- public function removeNonPublicDataFromArray(array $data) {
- // Currently call only inner method
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REGION-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...');
- $data = parent::removeNonPublicDataFromArray($data);
-
- // Return cleaned data
- return $data;
- }
-
- /**
- * Creates a region by given name
- *
- * @return void
- */
- public function createRegionByName () {
- // Pre-check
- die(__METHOD__ . ': Unfinshed!');
- assert(!$this->ifRegionExists($regionName));
-
- // Get user instance
- $userInstance = GenericRegistry::getRegistry()->getInstance('user');
-
- // Get a dataset instance
- $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_REGION_MAP));
-
- // Set the primary key
- $dataSetInstance->setUniqueKey(self::DB_COLUMN_REGION_ID);
-
- // Add region name and assign user id
- $dataSetInstance->addCriteria(self::DB_COLUMN_REGION_ID , ($this->countTotalRows() + 1));
-
- // "Insert" this dataset instance completely into the database
- $this->queryInsertDataSet($dataSetInstance);
-
- // Post-check name
- assert($this->ifRegionExists($regionName));
- }
-}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
* @param $className Real name of class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
namespace Org\Mxchange\City\Filter\Verifier;
// Import application-specific stuff
-use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper;
+use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend;
use Org\Mxchange\City\Factory\Manager\ManagerFactory;
// Import framework stuff
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get city name from request
- $cityName = $requestInstance->getRequestElement(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME);
+ $cityName = $requestInstance->getRequestElement(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME);
// Is the city name set?
if (is_null($cityName)) {
* @param $cityName Cityname to check for existence
* @return $alreadyTaken Whether the city name has been taken
*/
- private function ifCityNameIsTaken ($cityName) {
+ private function ifCityNameIsTaken (string $cityName) {
// Get a new instance
$managerInstance = ManagerFactory::createManagerByType('city');
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
namespace Org\Mxchange\City\Manager\City;
// Import application-specific stuff
-use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper;
+use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend;
use Org\Mxchange\City\Factory\Manager\ManagerFactory;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
// Get new instance
$managerInstance = new CityManager();
- // Get database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
+ // Get database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_info_db_frontend_class');
// And set it here
- $managerInstance->setWrapperInstance($wrapperInstance);
+ $managerInstance->setFrontendInstance($frontendInstance);
// Return the prepared instance
return $managerInstance;
*/
public function isCityAlreadyFounded () {
// Check if the currently set user has already founded a city
- $isFounded = $this->getWrapperInstance()->ifUserHasFoundedCity();
+ $isFounded = $this->getFrontendInstance()->ifUserHasFoundedCity();
// Return result
return $isFounded;
* @para $cityName Name of city
* @return $isTaken Whether the given city name is already taken
*/
- public function ifCityNameExists ($cityName) {
+ public function ifCityNameExists (string $cityName) {
// Check if the given city name is taken
- $isTaken = $this->getWrapperInstance()->ifCityExists($cityName);
+ $isTaken = $this->getFrontendInstance()->ifCityExists($cityName);
// Return result
return $isTaken;
public function foundFirstCity () {
// Check on request instance and 'city_name' element
assert(FrameworkBootstrap::getRequestInstance() instanceof Requestable);
- assert(FrameworkBootstrap::getRequestInstance()->isRequestElementSet(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME));
+ assert(FrameworkBootstrap::getRequestInstance()->isRequestElementSet(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME));
// Get city name
- $cityName = FrameworkBootstrap::getRequestInstance()->getRequestElement(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME);
+ $cityName = FrameworkBootstrap::getRequestInstance()->getRequestElement(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME);
// Some pre-checks
assert(!$this->isCityAlreadyFounded());
$regionData = $regionResultInstance->current();
// Add region id from it
- FrameworkBootstrap::getRequestInstance()->setRequestElement(CityInformationDatabaseWrapper::DB_COLUMN_CITY_REGION_ID, $regionData[RegionInformationDatabaseWrapper::DB_COLUMN_REGION_ID]);
+ FrameworkBootstrap::getRequestInstance()->setRequestElement(CityInformationDatabaseFrontend::DB_COLUMN_CITY_REGION_ID, $regionData[RegionInformationDatabaseFrontend::DB_COLUMN_REGION_ID]);
// Then create the first city
- $this->getWrapperInstance()->createCityByRequest(FrameworkBootstrap::getRequestInstance());
+ $this->getFrontendInstance()->createCityByRequest(FrameworkBootstrap::getRequestInstance());
}
/**
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
// Own namespace
namespace Org\Mxchange\City\Manager\Entities\Districts;
+// Import application-specific stuff
+use Org\Mxchange\City\Manager\BaseManager;
+
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class CityDistrictsManager extends BaseFrameworkSystem implements ManageableCityDistricts, Registerable {
+class CityDistrictsManager extends BaseManager implements ManageableCityDistricts, Registerable {
/**
* Protected constructor
*
// Get new instance
$managerInstance = new CityDistrictsManager();
- // Get database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_districts_db_wrapper_class');
+ // Get database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_districts_db_frontend_class');
// And set it here
- $managerInstance->setWrapperInstance($wrapperInstance);
+ $managerInstance->setFrontendInstance($frontendInstance);
// Return the prepared instance
return $managerInstance;
+++ /dev/null
-Deny from all
// Own namespace
namespace Org\Mxchange\City\Manager\Entities\Lots;
+// Import application-specific stuff
+use Org\Mxchange\City\Manager\BaseManager;
+
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class CityLotsManager extends BaseFrameworkSystem implements ManageableCityLots, Registerable {
+class CityLotsManager extends BaseManager implements ManageableCityLots, Registerable {
/**
* Protected constructor
*
// Get new instance
$managerInstance = new CityLotsManager();
- // Get database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_lots_db_wrapper_class');
+ // Get database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_lots_db_frontend_class');
// And set it here
- $managerInstance->setWrapperInstance($wrapperInstance);
+ $managerInstance->setFrontendInstance($frontendInstance);
// Return the prepared instance
return $managerInstance;
+++ /dev/null
-Deny from all
// Own namespace
namespace Org\Mxchange\City\Manager\Entities\Sections;
+// Load application-specific stuff
+use Org\Mxchange\City\Manager\BaseManager;
+
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class CitySectionsManager extends BaseFrameworkSystem implements ManageableCitySections, Registerable {
+class CitySectionsManager extends BaseManager implements ManageableCitySections, Registerable {
/**
* Protected constructor
*
// Get new instance
$managerInstance = new CitySectionsManager();
- // Get database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_sections_db_wrapper_class');
+ // Get database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_sections_db_frontend_class');
// And set it here
- $managerInstance->setWrapperInstance($wrapperInstance);
+ $managerInstance->setFrontendInstance($frontendInstance);
// Return the prepared instance
return $managerInstance;
$requireExpansion = FALSE;
// First, a simple check if the sections table contains any entries at all
- if ($this->getWrapperInstance()->countTotalRows() == 0) {
+ if ($this->getFrontendInstance()->countTotalRows() == 0) {
// This definedly requires expansion
$requireExpansion = TRUE;
} // END - if
* @todo z-coordinate not used
*/
public function expandMaps () {
- // Get a city info wrapper instance
- $cityWrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
+ // Get a city info frontend instance
+ $cityFrontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_info_db_frontend_class');
// Get all city ids from it
- $cityIds = $cityWrapperInstance->getAllCityIds();
+ $cityIds = $cityFrontendInstance->getAllCityIds();
// Now check all ids
foreach ($cityIds as $cityId) {
// Does this id have any sections
- if (!$this->getWrapperInstance()->ifCityHasSections($cityId)) {
+ if (!$this->getFrontendInstance()->ifCityHasSections($cityId)) {
// Nothing found, so it is a brand-new city that needs first initialization
- $sections = $this->getWrapperInstance()->doInitialCityExpansion($cityId);
+ $sections = $this->getFrontendInstance()->doInitialCityExpansion($cityId);
} else {
// @TODO Maybe some expansion is needed
}
// Import framework stuff
use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Traits\Database\Frontend\DatabaseFrontendTrait;
/**
* A general Manager class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseManager extends BaseCitySystem implements Manageable, Registerable {
+ // Load traits
+ use DatabaseFrontendTrait;
+
/**
* Protected constructor
*
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
+++ /dev/null
-Deny from all
namespace Org\Mxchange\City\Manager\Region;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
/**
* A game manager
// Get new instance
$managerInstance = new GameOptionsManager();
- // Get database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('game_options_db_wrapper_class');
+ // Get database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('game_options_db_frontend_class');
// And set it here
- $managerInstance->setWrapperInstance($wrapperInstance);
+ $managerInstance->setFrontendInstance($frontendInstance);
// Return the prepared instance
return $managerInstance;
+++ /dev/null
-Deny from all
namespace Org\Mxchange\City\Manager\Region;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
/**
* A Region manager
// Get new instance
$managerInstance = new RegionManager();
- // Get database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('region_info_db_wrapper_class');
+ // Get database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('region_info_db_frontend_class');
// And set it here
- $managerInstance->setWrapperInstance($wrapperInstance);
+ $managerInstance->setFrontendInstance($frontendInstance);
// Return the prepared instance
return $managerInstance;
*/
public function ifUserHasCreatedRegion () {
// Check if the currently set user has already founded a region
- $isFounded = $this->getWrapperInstance()->ifUserHasCreatedRegion();
+ $isFounded = $this->getFrontendInstance()->ifUserHasCreatedRegion();
// Return result
return $isFounded;
*/
public function ifRegionNameExists ($regionName) {
// Check if the given region name is taken
- $isTaken = $this->getWrapperInstance()->ifRegionExists($regionName);
+ $isTaken = $this->getFrontendInstance()->ifRegionExists($regionName);
// Return result
return $isTaken;
assert(!$this->ifRegionNameExists($regionName));
// First region can now be created
- $this->getWrapperInstance()->createRegionByName($regionName);
+ $this->getFrontendInstance()->createRegionByName($regionName);
// Then try to find it
assert($this->ifRegionNameExists($regionName));
namespace Org\Mxchange\City\Manager\RegionMap;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
/**
* A region map manager
// Get new instance
$managerInstance = new RegionMapManager();
- // Get database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('region_map_db_wrapper_class');
+ // Get database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('region_map_db_frontend_class');
// And set it here
- $managerInstance->setWrapperInstance($wrapperInstance);
+ $managerInstance->setFrontendInstance($frontendInstance);
// Return the prepared instance
return $managerInstance;
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registration\BaseRegistration;
use Org\Mxchange\CoreFramework\Registration\User\UserRegister;
* @todo Maybe add more things to perform
*/
public function registerNewUser () {
- // Get a user database wrapper
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('user_db_wrapper_class');
+ // Get a user database frontend
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('user_db_frontend_class');
// Use this instance to insert the whole registration instance
- $wrapperInstance->insertRegistrationObject($this);
+ $frontendInstance->insertRegistrationObject($this);
}
/**
} // END - foreach
// Mark the username as unique key
- $criteriaInstance->setUniqueKey(UserDatabaseWrapper::DB_COLUMN_USERNAME);
+ $criteriaInstance->setUniqueKey(UserDatabaseFrontend::DB_COLUMN_USERNAME);
// Add account status as configured
- $criteriaInstance->addConfiguredCriteria(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $configEntry);
+ $criteriaInstance->addConfiguredCriteria(UserDatabaseFrontend::DB_COLUMN_USER_STATUS, $configEntry);
// Include registration timestamp
$criteriaInstance->addCriteria('registered', date('Y-m-d H:i:s', time()));
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
$cfg->setConfigEntry('news_reader_class', 'Org\Mxchange\CoreFramework\Reader\News\Console\ConsoleNewsReader');
// CFG: CITY-INFO-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('city_info_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper');
+$cfg->setConfigEntry('city_info_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend');
// CFG: REGION-INFO-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('region_info_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\RegionInformation\RegionInformationDatabaseWrapper');
+$cfg->setConfigEntry('region_info_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\RegionInformation\RegionInformationDatabaseFrontend');
// CFG: GAME-OPTIONS-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('game_options_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\GameOptions\CityGameOptionsDatabaseWrapper');
+$cfg->setConfigEntry('game_options_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\GameOptions\CityGameOptionsDatabaseFrontend');
// CFG: REGION-MAP-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('region_map_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Region\RegionMapDatabaseWrapper');
+$cfg->setConfigEntry('region_map_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Region\RegionMapDatabaseFrontend');
// CFG: CITY-SECTIONS-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('city_sections_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Sections\CitySectionsDatabaseWrapper');
+$cfg->setConfigEntry('city_sections_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Sections\CitySectionsDatabaseFrontend');
// CFG: CITY-LOTS-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('city_lots_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Lots\CityLotsDatabaseWrapper');
+$cfg->setConfigEntry('city_lots_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Lots\CityLotsDatabaseFrontend');
// CFG: CITY-DISTRICTS-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('city_districts_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Districts\CityDistrictsDatabaseWrapper');
+$cfg->setConfigEntry('city_districts_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Districts\CityDistrictsDatabaseFrontend');
// CFG: CITY-INIT-STATE-CLASS
$cfg->setConfigEntry('city_init_state_class', 'Org\Mxchange\City\State\Init\CityInitState');
$cfg->setConfigEntry('bank_class', 'MoneyBank');
// CFG: USER-POINTS-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('user_points_db_wrapper_class', 'Org\Mxchange\CoreFramework\Database\Frontend\Points\UserPointsDatabaseWrapper');
+$cfg->setConfigEntry('user_points_db_frontend_class', 'Org\Mxchange\CoreFramework\Database\Frontend\Points\UserPointsDatabaseFrontend');
// CFG: USER-GOVERNMENT-WRAPPER-CLASS
-$cfg->setConfigEntry('user_government_wrapper_class', 'UserGovernmentDatabaseWrapper');
+$cfg->setConfigEntry('user_government_frontend_class', 'UserGovernmentDatabaseFrontend');
// CFG: PAYMENT-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('payment_db_wrapper_class', 'Org\Mxchange\CoreFramework\Database\Frontend\PaymentsDatabaseWrapper');
+$cfg->setConfigEntry('payment_db_frontend_class', 'Org\Mxchange\CoreFramework\Database\Frontend\PaymentsDatabaseFrontend');
// CFG: LOGIN-ENABLED
$cfg->setConfigEntry('login_enabled', 'Y');
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Information;
+
+// Import application-specific stuff
+use Org\Mxchange\City\Daemon\BaseCityDaemon;
+use Org\Mxchange\City\Helper\CityHelper;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+use Org\Mxchange\CoreFramework\Request\Requestable;
+
+/**
+ * An interface for city-information (database) frontend
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface CityInformationFrontend extends DatabaseFrontend {
+ /**
+ * 'Registers' a new city id along with data provided in the city instance.
+ * This may sound confusing but avoids double code very nicely...
+ *
+ * @param $cityInstance A city instance
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance);
+
+ /**
+ * Checks whether there is an entry for given city instance
+ *
+ * @param $cityInstance An instance of a CityHelper class
+ * @return $isFound Whether a city id has been found for this city
+ */
+ function ifCityDataIsFound (CityHelper $cityInstance);
+
+ /**
+ * Removes non-data from given array.
+ *
+ * @param $data An array with possible non-data that needs to be removed.
+ * @return $data A cleaned up array with only data.
+ */
+ function removeNonPublicDataFromArray(array $data);
+
+ /**
+ * Checks whether the user has already founded a city
+ *
+ * @return $hasFounded Whether the user has already founded a city
+ */
+ function ifUserHasFoundedCity ();
+
+ /**
+ * Checks whether the given city name is taken
+ *
+ * @para $cityName Name of city
+ * @return $isTaken Whether the given city name is taken
+ */
+ function ifCityExists (string $cityName);
+
+ /**
+ * Creates a city from given request
+ *
+ * @para $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ function createCityByRequest (Requestable $requestInstance);
+
+ /**
+ * Getter for all city ids as an array
+ *
+ * @return $cityIds All city ids as an array
+ */
+ function getAllCityIds ();
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Information;
-
-// Import application-specific stuff
-use Org\Mxchange\City\Daemon\BaseCityDaemon;
-use Org\Mxchange\City\Helper\CityHelper;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-use Org\Mxchange\CoreFramework\Request\Requestable;
-
-/**
- * An interface for city-information (database) wrapper
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface CityInformationWrapper extends DatabaseWrapper {
- /**
- * 'Registers' a new city id along with data provided in the city instance.
- * This may sound confusing but avoids double code very nicely...
- *
- * @param $cityInstance A city instance
- * @param $requestInstance An instance of a Requestable class
- * @return void
- */
- function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance);
-
- /**
- * Checks whether there is an entry for given city instance
- *
- * @param $cityInstance An instance of a CityHelper class
- * @return $isFound Whether a city id has been found for this city
- */
- function ifCityDataIsFound (CityHelper $cityInstance);
-
- /**
- * Removes non-data from given array.
- *
- * @param $data An array with possible non-data that needs to be removed.
- * @return $data A cleaned up array with only data.
- */
- function removeNonPublicDataFromArray(array $data);
-
- /**
- * Checks whether the user has already founded a city
- *
- * @return $hasFounded Whether the user has already founded a city
- */
- function ifUserHasFoundedCity ();
-
- /**
- * Checks whether the given city name is taken
- *
- * @para $cityName Name of city
- * @return $isTaken Whether the given city name is taken
- */
- function ifCityExists ($cityName);
-
- /**
- * Creates a city from given request
- *
- * @para $requestInstance An instance of a Requestable class
- * @return void
- */
- function createCityByRequest (Requestable $requestInstance);
-
- /**
- * Getter for all city ids as an array
- *
- * @return $cityIds All city ids as an array
- */
- function getAllCityIds ();
-}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Districts;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+
+/**
+ * An interface for city districts (database) frontend
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface CityDistrictsFrontend extends DatabaseFrontend {
+ /**
+ * Checks if the given city id is found in districts table
+ *
+ * @param $cityId City id to check
+ * @return $isFound Whether the city id is found
+ */
+ function ifCityHasDistricts (int $cityId);
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Districts;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-
-/**
- * An interface for city districts (database) wrapper
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface CityDistrictsWrapper extends DatabaseWrapper {
- /**
- * Checks if the given city id is found in districts table
- *
- * @param $cityId City id to check
- * @return $isFound Whether the city id is found
- */
- function ifCityHasDistricts ($cityId);
-}
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Lots;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+
+/**
+ * An interface for city lots (database) frontend
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface CityLotsFrontend extends DatabaseFrontend {
+ /**
+ * Checks if the given city id is found in lots table
+ *
+ * @param $cityId City id to check
+ * @return $isFound Whether the city id is found
+ */
+ function ifCityHasLots (int $cityId);
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Lots;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-
-/**
- * An interface for city lots (database) wrapper
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface CityLotsWrapper extends DatabaseWrapper {
- /**
- * Checks if the given city id is found in lots table
- *
- * @param $cityId City id to check
- * @return $isFound Whether the city id is found
- */
- function ifCityHasLots ($cityId);
-}
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Sections;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+
+/**
+ * An interface for city sections (database) frontend
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface CitySectionsFrontend extends DatabaseFrontend {
+ /**
+ * Checks if the given city id is found in sections table
+ *
+ * @param $cityId City id to check
+ * @return $isFound Whether the city id is found
+ */
+ function ifCityHasSections (int $cityId);
+
+ /**
+ * Expands the sections table with initial data for given city id
+ *
+ * @param $cityId City id to check
+ * @return $ids Sections ids from initial expansion
+ * @todo z-coordinate not used
+ */
+ function doInitialCityExpansion (int $cityId);
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Sections;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-
-/**
- * An interface for city sections (database) wrapper
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface CitySectionsWrapper extends DatabaseWrapper {
- /**
- * Checks if the given city id is found in sections table
- *
- * @param $cityId City id to check
- * @return $isFound Whether the city id is found
- */
- function ifCityHasSections ($cityId);
-
- /**
- * Expands the sections table with initial data for given city id
- *
- * @param $cityId City id to check
- * @return $ids Sections ids from initial expansion
- * @todo z-coordinate not used
- */
- function doInitialCityExpansion ($cityId);
-}
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\GameOptions;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+
+/**
+ * An interface for game options (database) frontend
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface CityGameOptionsFrontend extends DatabaseFrontend {
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\GameOptions;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-
-/**
- * An interface for game options (database) wrapper
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface CityGameOptionsWrapper extends DatabaseWrapper {
-}
+++ /dev/null
-Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\Information\Region;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+
+/**
+ * An interface for region-information (database) frontend
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface RegionInformationFrontend extends DatabaseFrontend {
+ /**
+ * Removes non-data from given array.
+ *
+ * @param $data An array with possible non-data that needs to be removed.
+ * @return $data A cleaned up array with only data.
+ */
+ function removeNonPublicDataFromArray(array $data);
+
+ /**
+ * Checks whether the user has already founded a region
+ *
+ * @return $hasFounded Whether the user has already founded a region
+ */
+ function ifUserHasCreatedRegion ();
+
+ /**
+ * Checks whether the given region name is taken
+ *
+ * @param $regionName Name of region
+ * @return $isTaken Whether the given region name is taken
+ */
+ function ifRegionExists ($regionName);
+
+ /**
+ * Creates a region by given name
+ *
+ * @param $regionName Name of region
+ * @return void
+ */
+ function createRegionByName ($regionName);
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\Information\Region;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-
-/**
- * An interface for region-information (database) wrapper
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface RegionInformationWrapper extends DatabaseWrapper {
- /**
- * Removes non-data from given array.
- *
- * @param $data An array with possible non-data that needs to be removed.
- * @return $data A cleaned up array with only data.
- */
- function removeNonPublicDataFromArray(array $data);
-
- /**
- * Checks whether the user has already founded a region
- *
- * @return $hasFounded Whether the user has already founded a region
- */
- function ifUserHasCreatedRegion ();
-
- /**
- * Checks whether the given region name is taken
- *
- * @param $regionName Name of region
- * @return $isTaken Whether the given region name is taken
- */
- function ifRegionExists ($regionName);
-
- /**
- * Creates a region by given name
- *
- * @param $regionName Name of region
- * @return void
- */
- function createRegionByName ($regionName);
-}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\City\Database\Frontend\RegionMap;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+
+/**
+ * An interface for region-map (database) frontend
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015, 2016 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface RegionMapFrontend extends DatabaseFrontend {
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\City\Database\Frontend\RegionMap;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-
-/**
- * An interface for region-map (database) wrapper
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015, 2016 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @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
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface RegionMapWrapper extends DatabaseWrapper {
-}
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
* @para $cityName Name of city
* @return $isTaken Whether the given city name is already taken
*/
- function ifCityNameExists ($cityName);
+ function ifCityNameExists (string $cityName);
/**
* Founds the first city. A dummy region will also be created
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
-Subproject commit 28ff0710d8eb3a2d0c1547d6ebeaae05eb50c7f6
+Subproject commit 303d853c3d98734f9d7a1a0445c98b6d6c444945