diff options
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); + } + } + + +} |