Completed
Pull Request — feature/stable-doctrine-module (#518)
by
unknown
23:58 queued 21:46
created

DBALConnection::setEventmanager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace DoctrineORMModule\Options;
21
22
use Zend\Stdlib\AbstractOptions;
23
24
/**
25
 * DBAL Connection options
26
 *
27
 * @license MIT
28
 * @link    http://www.doctrine-project.org/
29
 * @author  Kyle Spraggs <[email protected]>
30
 */
31
class DBALConnection extends AbstractOptions
32
{
33
    /**
34
     * Set the configuration key for the Configuration. Configuration key
35
     * is assembled as "doctrine.configuration.{key}" and pulled from
36
     * service locator.
37
     *
38
     * @var string
39
     */
40
    protected $configuration = 'orm_default';
41
42
    /**
43
     * Set the eventmanager key for the EventManager. EventManager key
44
     * is assembled as "doctrine.eventmanager.{key}" and pulled from
45
     * service locator.
46
     *
47
     * @var string
48
     */
49
    protected $eventmanager = 'orm_default';
50
51
    /**
52
     * Set the PDO instance, if any, to use. If a string is set
53
     * then the alias is pulled from the service locator.
54
     *
55
     * @var null|string|\PDO
56
     */
57
    protected $pdo = null;
58
59
    /**
60
     * Setting the driver is deprecated. You should set the
61
     * driver class directly instead.
62
     *
63
     * @var string
64
     */
65
    protected $driverClass = 'Doctrine\DBAL\Driver\PDOMySql\Driver';
66
67
    /**
68
     * Set the wrapper class for the driver. In general, this should not
69
     * need to be changed.
70
     *
71
     * @var string|null
72
     */
73
    protected $wrapperClass = null;
74
75
    /**
76
     * Driver specific connection parameters.
77
     *
78
     * @var array
79
     */
80
    protected $params = array();
81
82
    /**
83
     * @var array
84
     */
85
    protected $doctrineTypeMappings = array();
86
87
    /**
88
     * @var array
89
     */
90
    protected $doctrineCommentedTypes = array();
91
92
    /**
93
     * @param string $configuration
94
     */
95
    public function setConfiguration($configuration)
96
    {
97
        $this->configuration = $configuration;
98
    }
99
100
    /**
101
     * @return string
102
     */
103
    public function getConfiguration()
104
    {
105
        return "doctrine.configuration.{$this->configuration}";
106
    }
107
108
    /**
109
     * @param string $eventmanager
110
     */
111
    public function setEventmanager($eventmanager)
112
    {
113
        $this->eventmanager = $eventmanager;
114
    }
115
116
    /**
117
     * @return string
118
     */
119
    public function getEventmanager()
120
    {
121
        return "doctrine.eventmanager.{$this->eventmanager}";
122
    }
123
124
    /**
125
     * @param array $params
126
     */
127
    public function setParams($params)
128
    {
129
        $this->params = $params;
130
    }
131
132
    /**
133
     * @return array
134
     */
135
    public function getParams()
136
    {
137
        return $this->params;
138
    }
139
140
    /**
141
     * @param  array                                     $doctrineTypeMappings
142
     * @return \DoctrineORMModule\Options\DBALConnection
143
     */
144
    public function setDoctrineTypeMappings($doctrineTypeMappings)
145
    {
146
        $this->doctrineTypeMappings = (array) $doctrineTypeMappings;
147
148
        return $this;
149
    }
150
151
    /**
152
     *
153
     * @return array
154
     */
155
    public function getDoctrineTypeMappings()
156
    {
157
        return $this->doctrineTypeMappings;
158
    }
159
160
    /**
161
     * @param  array                                     $doctrineCommentedTypes
162
     */
163 2
    public function setDoctrineCommentedTypes(array $doctrineCommentedTypes)
164
    {
165 2
        $this->doctrineCommentedTypes = $doctrineCommentedTypes;
166 2
    }
167
168
    /**
169
     * @return array
170
     */
171 2
    public function getDoctrineCommentedTypes()
172
    {
173 2
        return $this->doctrineCommentedTypes;
174
    }
175
176
    /**
177
     * @param null|string $driverClass
178
     */
179
    public function setDriverClass($driverClass)
180
    {
181
        $this->driverClass = $driverClass;
182
    }
183
184
    /**
185
     * @return null|string
186
     */
187
    public function getDriverClass()
188
    {
189
        return $this->driverClass;
190
    }
191
192
    /**
193
     * @param null|\PDO|string $pdo
194
     */
195
    public function setPdo($pdo)
196
    {
197
        $this->pdo = $pdo;
198
    }
199
200
    /**
201
     * @return null|\PDO|string
202
     */
203
    public function getPdo()
204
    {
205
        return $this->pdo;
206
    }
207
208
    /**
209
     * @param string $wrapperClass
210
     */
211
    public function setWrapperClass($wrapperClass)
212
    {
213
        $this->wrapperClass = $wrapperClass;
214
    }
215
216
    /**
217
     * @return string
218
     */
219
    public function getWrapperClass()
220
    {
221
        return $this->wrapperClass;
222
    }
223
}
224