Commit effaf272 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 689469a9
Lazy-connecting to database is handled via Doctrine_Db wrapper. When using Doctrine_Db instead of PDO / Doctrine_Adapter, lazy-connecting to database is being performed (that means Doctrine will only connect to database when needed).
Lazy-connecting to database can save a lot of resources. There might be many pages where you don't need an actual database connection, hence its always recommended to use lazy-connecting (that means Doctrine will only connect to database when needed).
This feature can be very useful when using for example page caching, hence not actually needing a database connection on every request. Remember connecting to database is an expensive operation.
<code type="php">
// we may use PDO / PEAR like DSN
// here we use PEAR like DSN
$dbh = new Doctrine_Db('mysql://username:password@localhost/test');
// !! no actual database connection yet !!
$dsn = 'mysql://username:password@localhost/test';
// initalize a new Doctrine_Connection
$conn = Doctrine_Manager::connection($dbh);
$conn = Doctrine_Manager::connection($dsn);
// !! no actual database connection yet !!
// connects database and performs a query
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment