On Fri, 28 May 2010, Mohammad Ali Safari wrote:

> I want to be able to change the database server base on some info from
> users, e.g. their IP address. Has anybody implemented such a thing, or has
> an idea on how to do that?
> 
> I tried creating a filter class to be executed at the beginning of filter
> chain with some logic like this:
> 
> $database = new sfPropelDatabase($params);
> $database->initialize(array (
>   'phptype' => 'mysql',
>   'hostspec' => --server--
>   'database' =>--db_name--
>   'username' => --db_pass--,
>   'password' => --db_password--,
> ), 'propel');
> sfContext::getInstance()->databases['propel'] = $database;

Which version of symfony? Which version of Propel?

e.g. might be possible to extend sfDatabase and create your own database 
class (similar to sfPDODatabase) and then you can create your own database 
connections.

(I haven't done this myself but looking through the database classes, I 
saw how sfPDODatabase creates connections and thought it might be 
possible).

Or you might be able to create a connection in your model by passing in 
suitable parameters from the action.


-- 


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to