symfony API

sfDatabaseManager Class

« Back to API menu

action

addon

autoload

cache

command

config

controller

creole

database

debug

exception

filter

form

generator

helper

i18n

log

plugin

propel

request

response

routing

storage

task

test

user

util

validator

view

widget

You are currently browsing the symfony API for the 1.1 version. Switch to:

sfDatabaseManager allows you to setup your database connectivity before the request is handled. This eliminates the need for a filter to manage database connections.

Method Summary

  • __construct($configuration, $options = array())
    Class constructor.
  • shutdown()
    Executes the shutdown procedure
  • bool initialize($configuration)
    Initializes this sfDatabaseManager object
  • array getNames()
    Returns the names of all database connections.
  • setDatabase($name, $database, (sfDatabase) $sfDatabase)
    Sets a database connection.
  • mixed getDatabase($name = 'default')
    Retrieves the database connection associated with this sfDatabase implementation.
  • loadConfiguration()
    Loads database configuration.

Method Details

  • __construct ($configuration, $options = array())

    Class constructor.

  • shutdown ()

    Executes the shutdown procedure

    throws sfDatabaseException If an error occurs while shutting down this DatabaseManager

  • (bool) initialize ($configuration)

    $configuration A sfApplicationConfiguration instance

    Initializes this sfDatabaseManager object

    returns true, if initialization completes successfully, otherwise false

    throws sfInitializationException If an error occurs while initializing this sfDatabaseManager object

  • (array) getNames ()

    Returns the names of all database connections.

    returns An array containing all database connection names

  • setDatabase ($name, $database, (sfDatabase) $sfDatabase)

    $name The database name
    $sfDatabase A sfDatabase instance

    Sets a database connection.

  • (mixed) getDatabase ($name = 'default')

    $name A database name

    Retrieves the database connection associated with this sfDatabase implementation.

    returns A Database instance

    throws sfDatabaseException If the requested database name does not exist

  • loadConfiguration ()

    Loads database configuration.