Completed
Push — master ( c00473...569398 )
by Tom
01:40 queued 10s
created

DBALConnection::useSavepoints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace DoctrineORMModule\Options;
4
5
use Doctrine\DBAL\Driver\PDOMySql\Driver;
6
use Zend\Stdlib\AbstractOptions;
7
8
/**
9
 * DBAL Connection options
10
 *
11
 * @license MIT
12
 * @link    http://www.doctrine-project.org/
13
 * @author  Kyle Spraggs <[email protected]>
14
 */
15
class DBALConnection extends AbstractOptions
16
{
17
    /**
18
     * Set the configuration key for the Configuration. Configuration key
19
     * is assembled as "doctrine.configuration.{key}" and pulled from
20
     * service locator.
21
     *
22
     * @var string
23
     */
24
    protected $configuration = 'orm_default';
25
26
    /**
27
     * Set the eventmanager key for the EventManager. EventManager key
28
     * is assembled as "doctrine.eventmanager.{key}" and pulled from
29
     * service locator.
30
     *
31
     * @var string
32
     */
33
    protected $eventmanager = 'orm_default';
34
35
    /**
36
     * Set the PDO instance, if any, to use. If a string is set
37
     * then the alias is pulled from the service locator.
38
     *
39
     * @var null|string|\PDO
40
     */
41
    protected $pdo = null;
42
43
    /**
44
     * Setting the driver is deprecated. You should set the
45
     * driver class directly instead.
46
     *
47
     * @var string
48
     */
49
    protected $driverClass = Driver::class;
50
51
    /**
52
     * Set the wrapper class for the driver. In general, this should not
53
     * need to be changed.
54
     *
55
     * @var string|null
56
     */
57
    protected $wrapperClass = null;
58
59
    /**
60
     * Driver specific connection parameters.
61
     *
62
     * @var array
63
     */
64
    protected $params = [];
65
66
    /**
67
     * @var array
68
     */
69
    protected $doctrineTypeMappings = [];
70
71
    /**
72
     * @var array
73
     */
74
    protected $doctrineCommentedTypes = [];
75
76
    /**
77
     * @var bool
78
     */
79
    protected $useSavepoints = false;
80
81
    /**
82
     * @param string $configuration
83
     */
84 72
    public function setConfiguration($configuration)
85
    {
86 72
        $this->configuration = $configuration;
87 72
    }
88
89
    /**
90
     * @return string
91
     */
92 72
    public function getConfiguration()
93
    {
94 72
        return "doctrine.configuration.{$this->configuration}";
95
    }
96
97
    /**
98
     * @param string $eventmanager
99
     */
100 72
    public function setEventmanager($eventmanager)
101
    {
102 72
        $this->eventmanager = $eventmanager;
103 72
    }
104
105
    /**
106
     * @return string
107
     */
108 72
    public function getEventmanager()
109
    {
110 72
        return "doctrine.eventmanager.{$this->eventmanager}";
111
    }
112
113
    /**
114
     * @param array $params
115
     */
116 72
    public function setParams($params)
117
    {
118 72
        $this->params = $params;
119 72
    }
120
121
    /**
122
     * @return array
123
     */
124 72
    public function getParams()
125
    {
126 72
        return $this->params;
127
    }
128
129
    /**
130
     * @param  array                                     $doctrineTypeMappings
131
     * @return \DoctrineORMModule\Options\DBALConnection
132
     */
133
    public function setDoctrineTypeMappings($doctrineTypeMappings)
134
    {
135
        $this->doctrineTypeMappings = (array) $doctrineTypeMappings;
136
137
        return $this;
138
    }
139
140
    /**
141
     *
142
     * @return array
143
     */
144 72
    public function getDoctrineTypeMappings()
145
    {
146 72
        return $this->doctrineTypeMappings;
147
    }
148
149
    /**
150
     * @param  array                                     $doctrineCommentedTypes
151
     */
152 2
    public function setDoctrineCommentedTypes(array $doctrineCommentedTypes)
153
    {
154 2
        $this->doctrineCommentedTypes = $doctrineCommentedTypes;
155 2
    }
156
157
    /**
158
     * @return array
159
     */
160 74
    public function getDoctrineCommentedTypes()
161
    {
162 74
        return $this->doctrineCommentedTypes;
163
    }
164
165
    /**
166
     * @param null|string $driverClass
167
     */
168 72
    public function setDriverClass($driverClass)
169
    {
170 72
        $this->driverClass = $driverClass;
171 72
    }
172
173
    /**
174
     * @return null|string
175
     */
176 72
    public function getDriverClass()
177
    {
178 72
        return $this->driverClass;
179
    }
180
181
    /**
182
     * @param null|\PDO|string $pdo
183
     */
184
    public function setPdo($pdo)
185
    {
186
        $this->pdo = $pdo;
187
    }
188
189
    /**
190
     * @return null|\PDO|string
191
     */
192 72
    public function getPdo()
193
    {
194 72
        return $this->pdo;
195
    }
196
197
    /**
198
     * @param string $wrapperClass
199
     */
200
    public function setWrapperClass($wrapperClass)
201
    {
202
        $this->wrapperClass = $wrapperClass;
203
    }
204
205
    /**
206
     * @return string
207
     */
208 72
    public function getWrapperClass()
209
    {
210 72
        return $this->wrapperClass;
211
    }
212
213
    /**
214
     * @return bool
215
     */
216 72
    public function useSavepoints()
217
    {
218 72
        return $this->useSavepoints;
219
    }
220
221
    /**
222
     * @param bool $useSavepoints
223
     */
224
    public function setUseSavepoints($useSavepoints)
225
    {
226
        $this->useSavepoints = $useSavepoints;
227
    }
228
}
229