add multi database option along with related zend configuration module (#439)
[openemr.git] / interface / modules / zend_modules / module / Multipledb / src / Multipledb / Model / Multipledb.php
blob79c5d311ac33a2ddced2b96c4af26c1db947471e
1 <?php
3 /* +-----------------------------------------------------------------------------+
4 * Copyright 2016 matrix israel
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 3
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see
15 * http://www.gnu.org/licenses/licenses.html#GPL
16 * @author Oshri Rozmarin <oshri.rozmarin@gmail.com>
17 * +------------------------------------------------------------------------------+
21 namespace Multipledb\Model;
22 use Zend\InputFilter\InputFilter;
23 use Zend\InputFilter\InputFilterAwareInterface;
24 use Zend\InputFilter\InputFilterInterface;
27 class Multipledb implements InputFilterAwareInterface
30 const FIELD_ID = "id";
31 public $id;
32 public $namespace;
33 public $username;
34 public $password;
35 public $dbname;
36 public $host;
37 public $port;
38 public $date;
40 public function exchangeArray($data)
43 $this->id = (!empty($data['id'])) ? $data['id'] : null;
44 $this->namespace = (!empty($data['namespace'])) ? $data['namespace'] : null;
45 $this->username = (!empty($data['username'])) ? $data['username'] : null;
46 $this->password = (!empty($data['password'])) ? $data['password'] : null;
47 $this->dbname = (!empty($data['dbname'])) ? $data['dbname'] : null;
48 $this->host = (!empty($data['host'])) ? $data['host'] : null;
49 $this->port = (!empty($data['port'])) ? $data['port'] : null;
50 $this->date = (!empty($data['date'])) ? $data['date'] : null;
58 public static $inputsValidations = array(
59 array(
60 'name' => 'id',
61 'required' => true,
62 'filters' => array(
63 array('name' => 'Int'),
66 array(
67 'name' => 'namespace',
68 'required' => true,
71 array(
72 'name' => 'username',
73 'required' => true,
76 array(
77 'name' => 'password',
78 'required' => true,
80 array(
81 'name' => 'dbname',
82 'required' => true,
84 array(
85 'name' => 'host',
86 'required' => true,
88 array(
89 'name' => 'port',
90 'required' => true,
91 'filters' => array(
92 array('name' => 'Int'),
99 public function setInputFilter(InputFilterInterface $inputFilter)
101 throw new \Exception("Not used");
104 public function getInputFilter()
106 if (!$this->inputFilter) {
107 $inputFilter = new InputFilter();
109 foreach(self::$inputsValidations as $input) {
110 $inputFilter->add($input);
113 $this->inputFilter = $inputFilter;
115 return $this->inputFilter;