diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-06 17:36:54 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-06 17:36:54 +0100 |
commit | 23dcd8e5bff6a2e366b085ac373638206652f055 (patch) | |
tree | 0bafb8ac92d7bfa3948369d4c0772758fda3c738 /db/mapperfactory.php | |
parent | 31975bfab7d8f94ce3d2f438caa50ac21547d655 (diff) |
fix mysql
Diffstat (limited to 'db/mapperfactory.php')
-rw-r--r-- | db/mapperfactory.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/db/mapperfactory.php b/db/mapperfactory.php new file mode 100644 index 000000000..50dfa1d9b --- /dev/null +++ b/db/mapperfactory.php @@ -0,0 +1,40 @@ +<?php +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Alessandro Cosentino <cosenal@gmail.com> + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Alessandro Cosentino 2012 + * @copyright Bernhard Posselt 2012, 2014 + */ + +namespace OCA\News\Db; + +use \OCP\IDb; +use \OCA\News\Db\Mysql\ItemMapper as MysqlItemMapper; + +class MapperFactory { + + private $dbType; + private $db; + + public function __construct($dbType, IDb $db) { + $this->dbType = $dbType; + $this->db = $db; + } + + + public function getItemMapper() { + switch($this->dbType) { + case 'mysql': + return new MysqlItemMapper($this->db); + default: + return new ItemMapper($this->db); + } + } + + +} |