$myarray = sfYaml::load(sfConfig::get('sf_config_dir').'/myconf.yml');
Showing posts with label yaml. Show all posts
Showing posts with label yaml. Show all posts
Tuesday, February 21, 2012
Parse YML (Yaml) Files In Action in Symfony
Sunday, December 12, 2010
Get the MySQL Configuration Parameters from databases.yml
MySQL configuration is stored in config/databases.yml. Use the code below to get the parameters in an action.
$databaseConf = sfYaml::load(sfConfig::get('sf_config_dir') . '/databases.yml'); $params = $databaseConf ['all']['doctrine']['param']; $dsn = $params['dsn']; $username = $params['username']; $password = $params['password']; $database = substr($dsn, strpos($dsn, 'dbname=')+7);Only works if your dns parameter does not contain anything after the database's name, ex: dsn: mysql:host=localhost;dbname=thenameofthedatabase
Labels:
configuration,
database,
symfony,
yaml
Subscribe to:
Posts (Atom)