Runtime classes - Doctrine_Session.php 696 Bytes
Newer Older
doctrine's avatar
doctrine committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<?php
$sess = $manager->openSession(Doctrine_DB::getConnection("schema://username:password@hostname/database"));

// get session state:
switch($sess):
    case Doctrine_Session::STATE_BUSY:
        // multiple open transactions
    break;
    case Doctrine_Session::STATE_ACTIVE:
        // one open transaction
    break;
    case Doctrine_Session::STATE_CLOSED:
        // closed state
    break;
    case Doctrine_Session::STATE_OPEN:
        // open state and zero open transactions
    break;
endswitch;

// getting database handler

$dbh = $sess->getDBH();

// flushing the session
$sess->flush();


// print lots of useful info about session:
print $sess;
?>