]> git.mxchange.org Git - city.git/blobdiff - application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseWrapper.php
Continued:
[city.git] / application / city / classes / database / frontend / city_entities / districts / class_CityDistrictsDatabaseWrapper.php
diff --git a/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseWrapper.php b/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseWrapper.php
deleted file mode 100644 (file)
index b7722a6..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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;
-       }
-}