![]() |
|
Snippets |
|
To modify the settings of a connection named 'propel':
$con = sfContext::getInstance()->getDatabaseConnection('propel'); $con->setConnectionParameter('username', 'foo'); $con->setConnectionParameter('password', 'bar');
This works for all the settings that can be defined in the databases.yml (more info in the sfPropelDatabase class source).
You must execute this code before the first query to the database. If you do that after a first query, it fails. This means that the best way to implement it is in a filter.
Comments on this snippet
Doesn't work for me:
Fatal error: Call to undefined method MySQLConnection::setConnectionParameter()