ConnectionException.php 973 Bytes
Newer Older
1 2 3 4
<?php

namespace Doctrine\DBAL;

5 6 7
/**
 * @psalm-immutable
 */
8
class ConnectionException extends DBALException
9
{
Benjamin Morel's avatar
Benjamin Morel committed
10
    /**
Grégoire Paris's avatar
Grégoire Paris committed
11
     * @return ConnectionException
Benjamin Morel's avatar
Benjamin Morel committed
12
     */
13
    public static function commitFailedRollbackOnly()
14
    {
15
        return new self('Transaction commit failed because the transaction has been marked for rollback only.');
16
    }
17

Benjamin Morel's avatar
Benjamin Morel committed
18
    /**
Grégoire Paris's avatar
Grégoire Paris committed
19
     * @return ConnectionException
Benjamin Morel's avatar
Benjamin Morel committed
20
     */
21
    public static function noActiveTransaction()
22
    {
23
        return new self('There is no active transaction.');
24
    }
25

Benjamin Morel's avatar
Benjamin Morel committed
26
    /**
Grégoire Paris's avatar
Grégoire Paris committed
27
     * @return ConnectionException
Benjamin Morel's avatar
Benjamin Morel committed
28
     */
29 30
    public static function savepointsNotSupported()
    {
31
        return new self('Savepoints are not supported by this driver.');
32
    }
33

Benjamin Morel's avatar
Benjamin Morel committed
34
    /**
Grégoire Paris's avatar
Grégoire Paris committed
35
     * @return ConnectionException
Benjamin Morel's avatar
Benjamin Morel committed
36
     */
37 38
    public static function mayNotAlterNestedTransactionWithSavepointsInTransaction()
    {
39
        return new self('May not alter the nested transaction with savepoints behavior while a transaction is open.');
40
    }
Benjamin Eberlei's avatar
Benjamin Eberlei committed
41
}