Files
geodb/geoapi/api/Api.php
2013-06-26 12:12:10 +02:00

51 lines
1020 B
PHP

<?php
namespace api;
include_once "../../global.inc.php";
include_once PATH_DATABASE . "/SQLManager.php";
require_once PATH_3PARTY . "/Slim/Slim.php";
\Slim\Slim::registerAutoloader();
/**
* This class provides some general API methods
* @author stubbfel
* @since 20.06.2013
*/
abstract class Api extends \Slim\Slim {
/**
* Variable for the sql manager of the api
* @var <T>:SqlManager
*/
protected $sqlManager;
/**
* Default-Constructor
*/
public function __construct() {
$this->connect();
parent::__construct();
$this->contentType("Content-type: application/xml;charset=utf-8");
}
/**
* Default-DeConstructor
*/
public function __destruct() {
$this->sqlManager->closeConnection();
unset($this->sqlManager);
$this->sqlManager = null;
}
/**
* Method start a connection to the database
*/
public function connect() {
$this->sqlManager->connect();
}
}
?>