Working with objects - Component overview - Connection - Getting connection state.php 591 Bytes
Newer Older
hansbrix's avatar
hansbrix committed
1 2
Connection state gives you information about how active connection currently is. You can get the current state
by calling Doctrine_Connection::getState().
3

hansbrix's avatar
hansbrix committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<code type="php">
switch($conn->getState()):
    case Doctrine_Connection::STATE_ACTIVE:
        // connection open and zero open transactions
    break;
    case Doctrine_Connection::STATE_ACTIVE:
        // one open transaction
    break;
    case Doctrine_Connection::STATE_BUSY:
        // multiple open transactions
    break;
    case Doctrine_Connection::STATE_CLOSED:
        // connection closed
    break;
endswitch;
</code>