88use Doctrine \Common \EventManager ;
99use Doctrine \DBAL \Cache \ArrayStatement ;
1010use Doctrine \DBAL \Cache \CacheException ;
11+ use Doctrine \DBAL \Cache \Exception \NoResultDriverConfigured ;
1112use Doctrine \DBAL \Cache \QueryCacheProfile ;
1213use Doctrine \DBAL \Cache \ResultCacheStatement ;
1314use Doctrine \DBAL \Driver \Connection as DriverConnection ;
1617use Doctrine \DBAL \Driver \ResultStatement ;
1718use Doctrine \DBAL \Driver \ServerInfoAwareConnection ;
1819use Doctrine \DBAL \Driver \Statement as DriverStatement ;
20+ use Doctrine \DBAL \Exception \CommitFailedRollbackOnly ;
21+ use Doctrine \DBAL \Exception \EmptyCriteriaNotAllowed ;
1922use 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 ;
2027use Doctrine \DBAL \Platforms \AbstractPlatform ;
2128use Doctrine \DBAL \Query \Expression \ExpressionBuilder ;
2229use Doctrine \DBAL \Query \QueryBuilder ;
@@ -198,7 +205,7 @@ public function __construct(
198205
199206 if (isset ($ params ['platform ' ])) {
200207 if (! $ params ['platform ' ] instanceof Platforms \AbstractPlatform) {
201- throw DBALException:: invalidPlatformType ($ params ['platform ' ]);
208+ throw InvalidPlatformType:: new ($ params ['platform ' ]);
202209 }
203210
204211 $ this ->platform = $ params ['platform ' ];
@@ -641,7 +648,7 @@ private function addIdentifierCondition(
641648 public function delete ($ tableExpression , array $ identifier , array $ types = [])
642649 {
643650 if (empty ($ identifier )) {
644- throw InvalidArgumentException:: fromEmptyCriteria ();
651+ throw EmptyCriteriaNotAllowed:: new ();
645652 }
646653
647654 $ columns = $ values = $ conditions = [];
@@ -914,7 +921,7 @@ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qc
914921 $ resultCache = $ qcp ->getResultCacheDriver () ?? $ this ->_config ->getResultCacheImpl ();
915922
916923 if ($ resultCache === null ) {
917- throw CacheException:: noResultDriverConfigured ();
924+ throw NoResultDriverConfigured:: new ();
918925 }
919926
920927 $ connectionParams = $ this ->getParams ();
@@ -1124,11 +1131,11 @@ public function transactional(Closure $func)
11241131 public function setNestTransactionsWithSavepoints ($ nestTransactionsWithSavepoints )
11251132 {
11261133 if ($ this ->transactionNestingLevel > 0 ) {
1127- throw ConnectionException:: mayNotAlterNestedTransactionWithSavepointsInTransaction ();
1134+ throw MayNotAlterNestedTransactionWithSavepointsInTransaction:: new ();
11281135 }
11291136
11301137 if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1131- throw ConnectionException:: savepointsNotSupported ();
1138+ throw SavepointsNotSupported:: new ();
11321139 }
11331140
11341141 $ this ->nestTransactionsWithSavepoints = (bool ) $ nestTransactionsWithSavepoints ;
@@ -1190,11 +1197,10 @@ public function beginTransaction() : void
11901197 public function commit () : void
11911198 {
11921199 if ($ this ->transactionNestingLevel === 0 ) {
1193- throw ConnectionException:: noActiveTransaction ();
1200+ throw NoActiveTransaction:: new ();
11941201 }
1195-
11961202 if ($ this ->isRollbackOnly ) {
1197- throw ConnectionException:: commitFailedRollbackOnly ();
1203+ throw CommitFailedRollbackOnly:: new ();
11981204 }
11991205
12001206 $ connection = $ this ->getWrappedConnection ();
@@ -1253,7 +1259,7 @@ private function commitAll() : void
12531259 public function rollBack () : void
12541260 {
12551261 if ($ this ->transactionNestingLevel === 0 ) {
1256- throw ConnectionException:: noActiveTransaction ();
1262+ throw NoActiveTransaction:: new ();
12571263 }
12581264
12591265 $ connection = $ this ->getWrappedConnection ();
@@ -1297,7 +1303,7 @@ public function rollBack() : void
12971303 public function createSavepoint ($ savepoint )
12981304 {
12991305 if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1300- throw ConnectionException:: savepointsNotSupported ();
1306+ throw SavepointsNotSupported:: new ();
13011307 }
13021308
13031309 $ this ->getWrappedConnection ()->exec ($ this ->platform ->createSavePoint ($ savepoint ));
@@ -1315,7 +1321,7 @@ public function createSavepoint($savepoint)
13151321 public function releaseSavepoint ($ savepoint )
13161322 {
13171323 if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1318- throw ConnectionException:: savepointsNotSupported ();
1324+ throw SavepointsNotSupported:: new ();
13191325 }
13201326
13211327 if (! $ this ->platform ->supportsReleaseSavepoints ()) {
@@ -1337,7 +1343,7 @@ public function releaseSavepoint($savepoint)
13371343 public function rollbackSavepoint ($ savepoint )
13381344 {
13391345 if (! $ this ->getDatabasePlatform ()->supportsSavepoints ()) {
1340- throw ConnectionException:: savepointsNotSupported ();
1346+ throw SavepointsNotSupported:: new ();
13411347 }
13421348
13431349 $ this ->getWrappedConnection ()->exec ($ this ->platform ->rollbackSavePoint ($ savepoint ));
@@ -1382,7 +1388,7 @@ public function getSchemaManager()
13821388 public function setRollbackOnly ()
13831389 {
13841390 if ($ this ->transactionNestingLevel === 0 ) {
1385- throw ConnectionException:: noActiveTransaction ();
1391+ throw NoActiveTransaction:: new ();
13861392 }
13871393 $ this ->isRollbackOnly = true ;
13881394 }
@@ -1397,7 +1403,7 @@ public function setRollbackOnly()
13971403 public function isRollbackOnly ()
13981404 {
13991405 if ($ this ->transactionNestingLevel === 0 ) {
1400- throw ConnectionException:: noActiveTransaction ();
1406+ throw NoActiveTransaction:: new ();
14011407 }
14021408
14031409 return $ this ->isRollbackOnly ;
0 commit comments