Hello,

Please note, i've not tested, but it should works

1. extends the sfContext, ie: myContext
2. overwrite the initialize method from the sfContext

 protected function initialize()
  {
    $this->logger = sfLogger::getInstance();
    if (sfConfig::get('sf_logging_enabled'))
    {
      $this->logger->info('{sfContext} initialization');
    }

    // create a new action stack
    $this->actionStack = new sfActionStack();

    // include the factories configuration
    
require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/factories.yml'));


    if (sfConfig::get('sf_use_database'))
    {
      // setup our database connections
      $this->databaseManager = new myDatabaseManager();
      $this->databaseManager->initialize($this->getUser());
    }

    // register our shutdown function
    register_shutdown_function(array($this, 'shutdown'));
  }

3. extends the sfDatabaseManager, ie : myDatabaseManager
4. overwrite the initialize method of the sfDatabaseManager

  public function initialize($user)
  {
    // load database configuration
$database = new sfPropelDatabase();
$database->initialize(array (
  'dsn' => sprintf('%s://%s:[EMAIL PROTECTED]/%s',
  'your_db_driver',
  $user->getAttribute('username'),
  $user->getAttribute('password'),
  $user->getAttribute('hostname'),
  $user->getAttribute('database'),

), 'propel');
$this->databases['propel'] = $database;
  }

5. in your index.php
myContext::getInstance()->getController()->dispatch();

Good luck

Thomas

On Wed, Aug 27, 2008 at 5:21 PM, Pedro Bastos <[EMAIL PROTECTED]> wrote:
>
> Symfonians,
>
> I'm using Postgresql 8.3 with Symfony 1.0.
>
> I'd like to set username and password on the fly. I mean username and
> password will NOT be stored in databases.yml instead the username will
> be provided on login page. I walked through Symfony code and Propel
> seems to read DSN right from configuration file.
>
> I tried to use sfDatabase::setParameter with no effects.
>
> Any help?
>
> Thanks in advance,
>
> >
>



-- 
Thomas Rabaix
Internet Consultant

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

Reply via email to