tags:

views:

180

answers:

1

I use the following code to make Propel 1.4 works in a php file.

what should i do to make sure DatabaseManager delete correctly after its work?

shutdown at the end of the php file??

what will happen if there are multiple accesses to the same php file at the same time?

<?php

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');

$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
$dbManager = new sfDatabaseManager($configuration);
//start db access
+1  A: 

I'm not sure I understand your question. If you want to make sure the connection is closed at the end of the script, you should not worry, since this is the default for a PDO connection (PHP will automatically close the connection when your script ends).

If multiple clients connect to your site, multiple connections to the database will be made. This is not a problem, the database will handle the concurrency.

Jan Fabry
Thanks for your input. May be i should ask in this way. In symfony api, there is a shutdown function. i think i should shutdown at the end of the script. However, i don't want to initialize the connection every time i visit the page. what should i do to turn on connection pooling ?
Tommy