symfony API

sfContext Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.4 API OpenSearch

Packages

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

sfContext provides information about the current application context, such as

Method Summary

  • sfContext createInstance($configuration, $name, $class)
    Creates a new context instance.
  • dispatch()
    Dispatches the current request.
  • array filterTemplateParameters($event, $parameters)
    Listens to the template.filter_parameters event.
  • object get($name)
    Gets an object from the current context.
  • string getActionName()
    Retrieve the action name for this context.
  • sfActionStack getActionStack()
    Retrieve the ActionStack.
  • sfConfigCache getConfigCache()
    Returns the configuration cache.
  • sfApplicationConfiguration getConfiguration()
    Returns the configuration instance.
  • sfController getController()
    Retrieve the controller.
  • mixed getDatabaseConnection($name)
    Retrieve a database connection from the database manager.
  • sfDatabaseManager getDatabaseManager()
    Retrieve the database manager.
  • sfEventDispatcher getEventDispatcher()
    Retrieves the current event dispatcher.
  • sfI18N getI18N()
    Retrieve the i18n instance
  • sfContext getInstance($name, $class)
    Retrieves the singleton instance of this class.
  • sfLogger getLogger()
    Retrieve the logger.
  • sfMailer getMailer()
    Retrieves the mailer.
  • string getModuleDirectory()
    Retrieve the module directory for this context.
  • string getModuleName()
    Retrieve the module name for this context.
  • sfRequest getRequest()
    Retrieve the request.
  • sfResponse getResponse()
    Retrieve the response.
  • sfRouting getRouting()
    Retrieve the routing instance.
  • sfStorage getStorage()
    Retrieve the storage.
  • sfUser getUser()
    Retrieve the user.
  • sfViewCacheManager getViewCacheManager()
    Retrieve the view cache manager
  • bool has($name)
    Returns true if an object is currently stored in the current context with the given name, false otherwise.
  • bool hasInstance($name)
    Checks to see if there has been a context created
  • initialize($configuration)
    Initializes the current sfContext instance.
  • loadFactories()
    Loads the symfony factories.
  • Boolean offsetExists($name)
    Returns true if the context object exists (implements the ArrayAccess interface).
  • mixed offsetGet($name)
    Returns the context object associated with the name (implements the ArrayAccess interface).
  • offsetSet($offset, $value)
    Sets the context object associated with the offset (implements the ArrayAccess interface).
  • offsetUnset($offset)
    Unsets the context object associated with the offset (implements the ArrayAccess interface).
  • set($name, $object)
    Puts an object in the current context.
  • setMailerConfiguration()
  • void setResponse($response)
    Set the response object.
  • void shutdown()
    Execute the shutdown procedure.
  • switchTo($name)
    Sets the current context to something else
  • mixed __call($method, $arguments)
    Calls methods defined via sfEventDispatcher.

Method Details

  • (sfContext) createInstance ($configuration, $name, $class) Browse code

    $configuration An sfApplicationConfiguration instance
    $name A name for this context (application name by default)
    $class The context class to use (sfContext by default)

    Creates a new context instance.

    returns An sfContext instance

  • dispatch () Browse code

    Dispatches the current request.

  • (array) filterTemplateParameters ($event, $parameters) Browse code

    $event An sfEvent instance
    $parameters An array of template parameters to filter

    Listens to the template.filter_parameters event.

    returns The filtered parameters array

  • (object) get ($name) Browse code

    $name The name of the object to retrieve

    Gets an object from the current context.

    returns The object associated with the given name

  • (string) getActionName () Browse code

    Retrieve the action name for this context.

    returns The currently executing action name, if one is set, otherwise null.

  • (sfActionStack) getActionStack () Browse code

    Retrieve the ActionStack.

    returns the sfActionStack instance

  • (sfConfigCache) getConfigCache () Browse code

    Returns the configuration cache.

    returns A sfConfigCache instance

  • (sfApplicationConfiguration) getConfiguration () Browse code

    Returns the configuration instance.

    returns The current application configuration instance

  • (sfController) getController () Browse code

    Retrieve the controller.

    returns The current sfController implementation instance.

  • (mixed) getDatabaseConnection ($name) Browse code

    $name A database name.

    Retrieve a database connection from the database manager.


    This is a shortcut to manually getting a connection from an existing
    database implementation instance.

    If the [sf_use_database] setting is off, this will return null.

    returns A database instance.

    throws sfDatabaseException if the requested database name does not exist.

  • (sfDatabaseManager) getDatabaseManager () Browse code

    Retrieve the database manager.

    returns The current sfDatabaseManager instance.

  • (sfEventDispatcher) getEventDispatcher () Browse code

    Retrieves the current event dispatcher.

    returns An sfEventDispatcher instance

  • (sfI18N) getI18N () Browse code

    Retrieve the i18n instance

    returns The current sfI18N implementation instance.

  • (sfContext) getInstance ($name, $class) Browse code

    $name The name of the sfContext to retrieve.
    $class The context class to use (sfContext by default)

    Retrieves the singleton instance of this class.

    returns An sfContext implementation instance.

  • (sfLogger) getLogger () Browse code

    Retrieve the logger.

    returns The current sfLogger implementation instance.

  • (sfMailer) getMailer () Browse code

    Retrieves the mailer.

    returns The current sfMailer implementation instance.

  • (string) getModuleDirectory () Browse code

    Retrieve the module directory for this context.

    returns An absolute filesystem path to the directory of the currently executing module, if one is set, otherwise null.

  • (string) getModuleName () Browse code

    Retrieve the module name for this context.

    returns The currently executing module name, if one is set, otherwise null.

  • (sfRequest) getRequest () Browse code

    Retrieve the request.

    returns The current sfRequest implementation instance.

  • (sfResponse) getResponse () Browse code

    Retrieve the response.

    returns The current sfResponse implementation instance.

  • (sfRouting) getRouting () Browse code

    Retrieve the routing instance.

    returns The current sfRouting implementation instance.

  • (sfStorage) getStorage () Browse code

    Retrieve the storage.

    returns The current sfStorage implementation instance.

  • (sfUser) getUser () Browse code

    Retrieve the user.

    returns The current sfUser implementation instance.

  • (sfViewCacheManager) getViewCacheManager () Browse code

    Retrieve the view cache manager

    returns The current sfViewCacheManager implementation instance.

  • (bool) has ($name) Browse code

    $name The object name

    Returns true if an object is currently stored in the current context with the given name, false otherwise.

    returns true if the object is not null, false otherwise

  • (bool) hasInstance ($name) Browse code

    $name The name of the sfContext to check for

    Checks to see if there has been a context created

    returns true is instanced, otherwise false

  • initialize ($configuration) Browse code

    $configuration An sfApplicationConfiguration instance

    Initializes the current sfContext instance.

  • loadFactories () Browse code

    Loads the symfony factories.

  • (Boolean) offsetExists ($name) Browse code

    $name The name of the context object

    Returns true if the context object exists (implements the ArrayAccess interface).

    returns true if the context object exists, false otherwise

  • (mixed) offsetGet ($name) Browse code

    $name The offset of the value to get

    Returns the context object associated with the name (implements the ArrayAccess interface).

    returns The context object if exists, null otherwise

  • offsetSet ($offset, $value) Browse code

    $offset The parameter name
    $value The parameter value

    Sets the context object associated with the offset (implements the ArrayAccess interface).

  • offsetUnset ($offset) Browse code

    $offset The parameter name

    Unsets the context object associated with the offset (implements the ArrayAccess interface).

  • set ($name, $object) Browse code

    $name The name of the object to store
    $object The object to store

    Puts an object in the current context.

  • setMailerConfiguration () Browse code

  • (void) setResponse ($response) Browse code

    $response An sfResponse instance.

    Set the response object.

  • (void) shutdown () Browse code

    Execute the shutdown procedure.

  • switchTo ($name) Browse code

    $name The name of the context to switch to

    Sets the current context to something else

  • (mixed) __call ($method, $arguments) Browse code

    $method The method name
    $arguments The method arguments

    Calls methods defined via sfEventDispatcher.


    If a method cannot be found via sfEventDispatcher, the method name will
    be parsed to magically handle getMyFactory() and setMyFactory() methods.

    returns The returned value of the called method

    throws sfException if call fails