ConnectionException.php 1.01 KB
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 11 12
    /**
     * @return \Doctrine\DBAL\ConnectionException
     */
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 19 20
    /**
     * @return \Doctrine\DBAL\ConnectionException
     */
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 27 28
    /**
     * @return \Doctrine\DBAL\ConnectionException
     */
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 35 36
    /**
     * @return \Doctrine\DBAL\ConnectionException
     */
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
}