1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Kdyby (http://www.kdyby.org) |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2008 Filip Procházka ([email protected]) |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Kdyby\Doctrine; |
12
|
|
|
|
13
|
|
|
use Doctrine; |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @author Filip Procházka <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
interface Exception |
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @author Filip Procházka <[email protected]> |
29
|
|
|
*/ |
30
|
|
|
class InvalidStateException extends \RuntimeException implements Exception |
31
|
|
|
{ |
32
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @author Filip Procházka <[email protected]> |
39
|
|
|
*/ |
40
|
|
|
class InvalidArgumentException extends \InvalidArgumentException implements Exception |
41
|
|
|
{ |
42
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @author Filip Procházka <[email protected]> |
49
|
|
|
*/ |
50
|
|
|
class NotSupportedException extends \LogicException implements Exception |
51
|
|
|
{ |
52
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @author Filip Procházka <[email protected]> |
59
|
|
|
*/ |
60
|
|
|
class StaticClassException extends \LogicException implements Exception |
61
|
|
|
{ |
62
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* The exception that is thrown when a requested method or operation is not implemented. |
69
|
|
|
*/ |
70
|
|
|
class NotImplementedException extends \LogicException implements Exception |
71
|
|
|
{ |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
|
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* When class is not found |
79
|
|
|
*/ |
80
|
|
|
class MissingClassException extends \LogicException implements Exception |
81
|
|
|
{ |
82
|
|
|
|
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
|
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @author Filip Procházka <[email protected]> |
89
|
|
|
*/ |
90
|
|
|
class UnexpectedValueException extends \UnexpectedValueException implements Exception |
91
|
|
|
{ |
92
|
|
|
|
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
|
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @author Filip Procházka <[email protected]> |
99
|
|
|
* @deprecated |
100
|
|
|
*/ |
101
|
|
|
class DBALException extends \RuntimeException implements Exception |
102
|
|
|
{ |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @var string|NULL |
106
|
|
|
*/ |
107
|
|
|
public $query; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @var array |
111
|
|
|
*/ |
112
|
|
|
public $params = []; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @var \Doctrine\DBAL\Connection|NULL |
116
|
|
|
*/ |
117
|
|
|
public $connection; |
118
|
|
|
|
119
|
|
|
|
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param \Exception|\Throwable $previous |
123
|
|
|
* @param string|NULL $query |
124
|
|
|
* @param array $params |
125
|
|
|
* @param \Doctrine\DBAL\Connection|NULL $connection |
126
|
|
|
* @param string|NULL $message |
127
|
|
|
*/ |
128
|
|
|
public function __construct($previous, $query = NULL, $params = [], Doctrine\DBAL\Connection $connection = NULL, $message = NULL) |
129
|
|
|
{ |
130
|
|
|
parent::__construct($message ?: $previous->getMessage(), $previous->getCode(), $previous); |
131
|
|
|
$this->query = $query; |
132
|
|
|
$this->params = $params; |
133
|
|
|
$this->connection = $connection; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
|
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* This is just a paranoia, hopes no one actually serializes exceptions. |
140
|
|
|
* |
141
|
|
|
* @return array |
142
|
|
|
*/ |
143
|
|
|
public function __sleep() |
144
|
|
|
{ |
145
|
|
|
return ['message', 'code', 'file', 'line', 'errorInfo', 'query', 'params']; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
|
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @author Filip Procházka <[email protected]> |
154
|
|
|
* @deprecated |
155
|
|
|
*/ |
156
|
|
|
class DuplicateEntryException extends DBALException |
|
|
|
|
157
|
|
|
{ |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @var array |
161
|
|
|
*/ |
162
|
|
|
public $columns; |
163
|
|
|
|
164
|
|
|
|
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param \Exception|\Throwable $previous |
168
|
|
|
* @param array $columns |
169
|
|
|
* @param string $query |
170
|
|
|
* @param array $params |
171
|
|
|
* @param \Doctrine\DBAL\Connection $connection |
172
|
|
|
*/ |
173
|
|
|
public function __construct($previous, $columns = [], $query = NULL, $params = [], Doctrine\DBAL\Connection $connection = NULL) |
174
|
|
|
{ |
175
|
|
|
parent::__construct($previous, $query, $params, $connection); |
176
|
|
|
$this->columns = $columns; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
|
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return array |
183
|
|
|
*/ |
184
|
|
|
public function __sleep() |
185
|
|
|
{ |
186
|
|
|
return array_merge(parent::__sleep(), ['columns']); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
|
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @author Filip Procházka <[email protected]> |
195
|
|
|
* @deprecated |
196
|
|
|
*/ |
197
|
|
|
class EmptyValueException extends DBALException |
|
|
|
|
198
|
|
|
{ |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @var string|NULL |
202
|
|
|
*/ |
203
|
|
|
public $column; |
204
|
|
|
|
205
|
|
|
|
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* @param \Exception|\Throwable $previous |
209
|
|
|
* @param string|NULL $column |
210
|
|
|
* @param string $query |
211
|
|
|
* @param array $params |
212
|
|
|
* @param \Doctrine\DBAL\Connection $connection |
213
|
|
|
*/ |
214
|
|
|
public function __construct($previous, $column = NULL, $query = NULL, $params = [], Doctrine\DBAL\Connection $connection = NULL) |
215
|
|
|
{ |
216
|
|
|
parent::__construct($previous, $query, $params, $connection); |
217
|
|
|
$this->column = $column; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
|
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @return array |
224
|
|
|
*/ |
225
|
|
|
public function __sleep() |
226
|
|
|
{ |
227
|
|
|
return array_merge(parent::__sleep(), ['column']); |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
|
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @author Filip Procházka <[email protected]> |
236
|
|
|
*/ |
237
|
|
|
class QueryException extends \RuntimeException implements Exception |
238
|
|
|
{ |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @var \Doctrine\ORM\AbstractQuery|NULL |
242
|
|
|
*/ |
243
|
|
|
public $query; |
244
|
|
|
|
245
|
|
|
|
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @param \Exception|\Throwable $previous |
249
|
|
|
* @param \Doctrine\ORM\AbstractQuery|NULL $query |
250
|
|
|
* @param string|NULL $message |
251
|
|
|
*/ |
252
|
|
|
public function __construct($previous, Doctrine\ORM\AbstractQuery $query = NULL, $message = NULL) |
253
|
|
|
{ |
254
|
|
|
parent::__construct($message ?: $previous->getMessage(), 0, $previous); |
255
|
|
|
$this->query = $query; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
|
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* @author Michael Moravec |
264
|
|
|
*/ |
265
|
|
|
class ReadOnlyCollectionException extends NotSupportedException |
266
|
|
|
{ |
267
|
|
|
/** |
268
|
|
|
* @throws ReadOnlyCollectionException |
269
|
|
|
*/ |
270
|
|
|
public static function invalidAccess($what) |
271
|
|
|
{ |
272
|
|
|
return new static('Could not ' . $what . ' read-only collection, write/modify operations are forbidden.'); |
273
|
|
|
} |
274
|
|
|
} |
275
|
|
|
|
This class, trait or interface has been deprecated.