From effaf2729472633b69f8ac1c0b5968ba9e3c8687 Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 20 Jun 2007 13:17:15 +0000 Subject: [PATCH] --- .../lazy-connecting-to-database.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/manual/new/docs/en/connection-management/lazy-connecting-to-database.txt b/manual/new/docs/en/connection-management/lazy-connecting-to-database.txt index bf4bf8e8c..6c676a76f 100644 --- a/manual/new/docs/en/connection-management/lazy-connecting-to-database.txt +++ b/manual/new/docs/en/connection-management/lazy-connecting-to-database.txt @@ -1,15 +1,12 @@ -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. -// 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