Completed
Push — master ( 569398...78d4be )
by Tom
25s 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
declare(strict_types=1);
4
5
namespace DoctrineORMModule\Options;
6
7
use Doctrine\DBAL\Driver\PDOMySql\Driver;
8
use Laminas\Stdlib\AbstractOptions;
9
use PDO;
10
11
/**
12
 * DBAL Connection options
13
 */
14
class DBALConnection extends AbstractOptions
15
{
16
    /**
17
     * Set the configuration key for the Configuration. Configuration key
18
     * is assembled as "doctrine.configuration.{key}" and pulled from
19
     * service locator.
20
     *
21
     * @var string
22
     */
23
    protected $configuration = 'orm_default';
24
25
    /**
26
     * Set the eventmanager key for the EventManager. EventManager key
27
     * is assembled as "doctrine.eventmanager.{key}" and pulled from
28
     * service locator.
29
     *
30
     * @var string
31
     */
32
    protected $eventmanager = 'orm_default';
33
34
    /**
35
     * Set the PDO instance, if any, to use. If a string is set
36
     * then the alias is pulled from the service locator.
37
     *
38
     * @var string|PDO|null
39
     */
40
    protected $pdo = null;
41
42
    /**
43
     * Setting the driver is deprecated. You should set the
44
     * driver class directly instead.
45
     *
46
     * @var string
47
     */
48
    protected $driverClass = Driver::class;
49
50
    /**
51
     * Set the wrapper class for the driver. In general, this should not
52
     * need to be changed.
53
     *
54
     * @var string|null
55
     */
56
    protected $wrapperClass = null;
57
58
    /**
59
     * Driver specific connection parameters.
60
     *
61
     * @var mixed[]
62
     */
63
    protected $params = [];
64
65
    /** @var mixed[] */
66
    protected $doctrineTypeMappings = [];
67
68
    /** @var mixed[] */
69
    protected $doctrineCommentedTypes = [];
70
71
    /** @var bool */
72
    protected $useSavepoints = false;
73
74 72
    public function setConfiguration(string $configuration) : void
75
    {
76 72
        $this->configuration = $configuration;
77 72
    }
78
79 72
    public function getConfiguration() : string
80
    {
81 72
        return 'doctrine.configuration.' . $this->configuration;
82
    }
83
84 72
    public function setEventmanager(string $eventmanager) : void
85
    {
86 72
        $this->eventmanager = $eventmanager;
87 72
    }
88
89 72
    public function getEventmanager() : string
90
    {
91 72
        return 'doctrine.eventmanager.' . $this->eventmanager;
92
    }
93
94
    /**
95
     * @param mixed[] $params
96
     */
97 72
    public function setParams(array $params) : void
98
    {
99 72
        $this->params = $params;
100 72
    }
101
102
    /**
103
     * @return mixed[]
104
     */
105 72
    public function getParams() : array
106
    {
107 72
        return $this->params;
108
    }
109
110
    /**
111
     * @param mixed[] $doctrineTypeMappings
112
     */
113
    public function setDoctrineTypeMappings(array $doctrineTypeMappings) : DBALConnection
114
    {
115
        $this->doctrineTypeMappings = (array) $doctrineTypeMappings;
116
117
        return $this;
118
    }
119
120
    /**
121
     * @return mixed[]
122
     */
123 72
    public function getDoctrineTypeMappings() : array
124
    {
125 72
        return $this->doctrineTypeMappings;
126
    }
127
128
    /**
129
     * @param mixed[] $doctrineCommentedTypes
130
     */
131 2
    public function setDoctrineCommentedTypes(array $doctrineCommentedTypes) : void
132
    {
133 2
        $this->doctrineCommentedTypes = $doctrineCommentedTypes;
134 2
    }
135
136
    /**
137
     * @return mixed[]
138
     */
139 74
    public function getDoctrineCommentedTypes() : array
140
    {
141 74
        return $this->doctrineCommentedTypes;
142
    }
143
144 72
    public function setDriverClass(?string $driverClass) : void
145
    {
146 72
        $this->driverClass = $driverClass;
147 72
    }
148
149 72
    public function getDriverClass() : ?string
150
    {
151 72
        return $this->driverClass;
152
    }
153
154
    /**
155
     * @param PDO|string|null $pdo
156
     */
157
    public function setPdo($pdo) : void
158
    {
159
        $this->pdo = $pdo;
160
    }
161
162
    /**
163
     * @return PDO|string|null
164
     */
165 72
    public function getPdo()
166
    {
167 72
        return $this->pdo;
168
    }
169
170
    public function setWrapperClass(string $wrapperClass) : void
171
    {
172
        $this->wrapperClass = $wrapperClass;
173
    }
174
175 72
    public function getWrapperClass() : ?string
176
    {
177 72
        return $this->wrapperClass;
178
    }
179
180 72
    public function useSavepoints() : bool
181
    {
182 72
        return $this->useSavepoints;
183
    }
184
185
    public function setUseSavepoints(bool $useSavepoints) : void
186
    {
187
        $this->useSavepoints = $useSavepoints;
188
    }
189
}
190