8
8
use Doctrine \Common \EventManager ;
9
9
use Doctrine \DBAL \Cache \ArrayStatement ;
10
10
use Doctrine \DBAL \Cache \CacheException ;
11
+ use Doctrine \DBAL \Cache \Exception \NoResultDriverConfigured ;
11
12
use Doctrine \DBAL \Cache \QueryCacheProfile ;
12
13
use Doctrine \DBAL \Cache \ResultCacheStatement ;
13
14
use Doctrine \DBAL \Driver \Connection as DriverConnection ;
16
17
use Doctrine \DBAL \Driver \ResultStatement ;
17
18
use Doctrine \DBAL \Driver \ServerInfoAwareConnection ;
18
19
use Doctrine \DBAL \Driver \Statement as DriverStatement ;
20
+ use Doctrine \DBAL \Exception \CommitFailedRollbackOnly ;
21
+ use Doctrine \DBAL \Exception \EmptyCriteriaNotAllowed ;
19
22
use Doctrine \DBAL \Exception \InvalidArgumentException ;
23
+ use Doctrine \DBAL \Exception \InvalidPlatformType ;
24
+ use Doctrine \DBAL \Exception \MayNotAlterNestedTransactionWithSavepointsInTransaction ;
25
+ use Doctrine \DBAL \Exception \NoActiveTransaction ;
26
+ use Doctrine \DBAL \Exception \SavepointsNotSupported ;
20
27
use Doctrine \DBAL \Platforms \AbstractPlatform ;
21
28
use Doctrine \DBAL \Query \Expression \ExpressionBuilder ;
22
29
use Doctrine \DBAL \Query \QueryBuilder ;
@@ -198,7 +205,7 @@ public function __construct(
198
205
199
206
if (isset ($ params ['platform ' ])) {
200
207
if (! $ params ['platform ' ] instanceof Platforms \AbstractPlatform) {
201
- throw DBALException:: invalidPlatformType ($ params ['platform ' ]);
208
+ throw InvalidPlatformType:: new ($ params ['platform ' ]);
202
209
}
203
210
204
211
$ this ->platform = $ params ['platform ' ];
@@ -641,7 +648,7 @@ private function addIdentifierCondition(
641
648
public function delete ($ tableExpression , array $ identifier , array $ types = [])
642
649
{
643
650
if (empty ($ identifier )) {
644
- throw InvalidArgumentException:: fromEmptyCriteria ();
651
+ throw EmptyCriteriaNotAllowed:: new ();
645
652
}
646
653
647
654
$ columns = $ values = $ conditions = [];
@@ -914,7 +921,7 @@ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qc
914
921
$ resultCache = $ qcp ->getResultCacheDriver () ?? $ this ->_config ->getResultCacheImpl ();
915
922
916
923
if ($ resultCache === null ) {
917
- throw CacheException:: noResultDriverConfigured ();
924
+ throw NoResultDriverConfigured:: new ();
918
925
}
919
926
920
927
$ connectionParams = $ this ->getParams ();
@@ -1124,11 +1131,11 @@ public function transactional(Closure $func)
1124
1131
public function setNestTransactionsWithSavepoints ($ nestTransactionsWithSavepoints )
1125
1132
{
1126
1133
if ($ this ->transactionNestingLevel > 0 ) {
1127
- throw ConnectionException:: mayNotAlterNestedTransactionWithSavepointsInTransaction ();
1134
+ throw MayNotAlterNestedTransactionWithSavepointsInTransaction:: new ();
1128
1135
}
1129
1136
1130
1137
if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1131
- throw ConnectionException:: savepointsNotSupported ();
1138
+ throw SavepointsNotSupported:: new ();
1132
1139
}
1133
1140
1134
1141
$ this ->nestTransactionsWithSavepoints = (bool ) $ nestTransactionsWithSavepoints ;
@@ -1190,11 +1197,10 @@ public function beginTransaction() : void
1190
1197
public function commit () : void
1191
1198
{
1192
1199
if ($ this ->transactionNestingLevel === 0 ) {
1193
- throw ConnectionException:: noActiveTransaction ();
1200
+ throw NoActiveTransaction:: new ();
1194
1201
}
1195
-
1196
1202
if ($ this ->isRollbackOnly ) {
1197
- throw ConnectionException:: commitFailedRollbackOnly ();
1203
+ throw CommitFailedRollbackOnly:: new ();
1198
1204
}
1199
1205
1200
1206
$ connection = $ this ->getWrappedConnection ();
@@ -1253,7 +1259,7 @@ private function commitAll() : void
1253
1259
public function rollBack () : void
1254
1260
{
1255
1261
if ($ this ->transactionNestingLevel === 0 ) {
1256
- throw ConnectionException:: noActiveTransaction ();
1262
+ throw NoActiveTransaction:: new ();
1257
1263
}
1258
1264
1259
1265
$ connection = $ this ->getWrappedConnection ();
@@ -1297,7 +1303,7 @@ public function rollBack() : void
1297
1303
public function createSavepoint ($ savepoint )
1298
1304
{
1299
1305
if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1300
- throw ConnectionException:: savepointsNotSupported ();
1306
+ throw SavepointsNotSupported:: new ();
1301
1307
}
1302
1308
1303
1309
$ this ->getWrappedConnection ()->exec ($ this ->platform ->createSavePoint ($ savepoint ));
@@ -1315,7 +1321,7 @@ public function createSavepoint($savepoint)
1315
1321
public function releaseSavepoint ($ savepoint )
1316
1322
{
1317
1323
if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1318
- throw ConnectionException:: savepointsNotSupported ();
1324
+ throw SavepointsNotSupported:: new ();
1319
1325
}
1320
1326
1321
1327
if (! $ this ->platform ->supportsReleaseSavepoints ()) {
@@ -1337,7 +1343,7 @@ public function releaseSavepoint($savepoint)
1337
1343
public function rollbackSavepoint ($ savepoint )
1338
1344
{
1339
1345
if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1340
- throw ConnectionException:: savepointsNotSupported ();
1346
+ throw SavepointsNotSupported:: new ();
1341
1347
}
1342
1348
1343
1349
$ this ->getWrappedConnection ()->exec ($ this ->platform ->rollbackSavePoint ($ savepoint ));
@@ -1382,7 +1388,7 @@ public function getSchemaManager()
1382
1388
public function setRollbackOnly ()
1383
1389
{
1384
1390
if ($ this ->transactionNestingLevel === 0 ) {
1385
- throw ConnectionException:: noActiveTransaction ();
1391
+ throw NoActiveTransaction:: new ();
1386
1392
}
1387
1393
$ this ->isRollbackOnly = true ;
1388
1394
}
@@ -1397,7 +1403,7 @@ public function setRollbackOnly()
1397
1403
public function isRollbackOnly ()
1398
1404
{
1399
1405
if ($ this ->transactionNestingLevel === 0 ) {
1400
- throw ConnectionException:: noActiveTransaction ();
1406
+ throw NoActiveTransaction:: new ();
1401
1407
}
1402
1408
1403
1409
return $ this ->isRollbackOnly ;
0 commit comments