diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-05-07 21:10:51 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-05-07 21:10:51 +0200 |
| commit | 58919afe451ad5b2088d61ff1c856f44dd522b32 (patch) | |
| tree | b5963cc7d1fdf2704de345b9333c207c3dd0a5bf /src/phorkie/Database.php | |
| parent | 7c5ea8dded583601f29c7ea9bcb507ecbdd854d6 (diff) | |
| download | phorkie-58919afe451ad5b2088d61ff1c856f44dd522b32.tar.gz phorkie-58919afe451ad5b2088d61ff1c856f44dd522b32.zip | |
add interfaces for database adapter
Diffstat (limited to 'src/phorkie/Database.php')
| -rw-r--r-- | src/phorkie/Database.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/phorkie/Database.php b/src/phorkie/Database.php index 9854e7c..786cfe0 100644 --- a/src/phorkie/Database.php +++ b/src/phorkie/Database.php @@ -3,19 +3,30 @@ namespace phorkie; class Database { + public $prefix = '\phorkie\Database_Adapter_Null'; + + public function __construct() + { + if ($GLOBALS['phorkie']['cfg']['elasticsearch'] != '') { + $this->prefix = '\phorkie\Database_Adapter_Elasticsearch'; + } + } public function getSearch() { - return new Database_Adapter_Elasticsearch_Search(); + $class = $this->prefix . '_Search'; + return new $class(); } public function getIndexer() { - return new Database_Adapter_Elasticsearch_Indexer(); + $class = $this->prefix . '_Indexer'; + return new $class(); } public function getSetup() { - return new Database_Adapter_Elasticsearch_Setup(); + $class = $this->prefix . '_Setup'; + return new $class(); } } |
