aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/Database.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-05-07 21:10:51 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-05-07 21:10:51 +0200
commit58919afe451ad5b2088d61ff1c856f44dd522b32 (patch)
treeb5963cc7d1fdf2704de345b9333c207c3dd0a5bf /src/phorkie/Database.php
parent7c5ea8dded583601f29c7ea9bcb507ecbdd854d6 (diff)
downloadphorkie-58919afe451ad5b2088d61ff1c856f44dd522b32.tar.gz
phorkie-58919afe451ad5b2088d61ff1c856f44dd522b32.zip
add interfaces for database adapter
Diffstat (limited to 'src/phorkie/Database.php')
-rw-r--r--src/phorkie/Database.php17
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();
}
}