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