PHP Class sfContext

Author: Fabien Potencier ([email protected])
Author: Sean Kerr ([email protected])
Inheritance: implements ArrayAccess
Afficher le fichier Open project: lexpress/symfony1 Class Usage Examples

Protected Properties

Свойство Type Description
$configuration
$current
$dispatcher
$factories
$hasShutdownUserAndStorage
$instances
$mailerConfiguration
$serviceContainerConfiguration

Méthodes publiques

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

Method Details

__call() public méthode

If a method cannot be found via sfEventDispatcher, the method name will be parsed to magically handle getMyFactory() and setMyFactory() methods.
public __call ( string $method, array $arguments ) : mixed
$method string The method name
$arguments array The method arguments
Résultat mixed The returned value of the called method

createInstance() public static méthode

Creates a new context instance.
public static createInstance ( sfApplicationConfiguration $configuration, string $name = null, string $class = __CLASS__ ) : sfContext
$configuration sfApplicationConfiguration An sfApplicationConfiguration instance
$name string A name for this context (application name by default)
$class string The context class to use (sfContext by default)
Résultat sfContext An sfContext instance

dispatch() public méthode

Dispatches the current request.
public dispatch ( )

filterTemplateParameters() public méthode

Listens to the template.filter_parameters event.
public filterTemplateParameters ( sfEvent $event, array $parameters ) : array
$event sfEvent An sfEvent instance
$parameters array An array of template parameters to filter
Résultat array The filtered parameters array

get() public méthode

Gets an object from the current context.
public get ( string $name ) : object
$name string The name of the object to retrieve
Résultat object The object associated with the given name

getActionName() public méthode

Retrieve the action name for this context.
public getActionName ( ) : string
Résultat string The currently executing action name, if one is set, otherwise null.

getActionStack() public méthode

Retrieve the ActionStack.
public getActionStack ( ) : sfActionStack
Résultat sfActionStack the sfActionStack instance

getConfigCache() public méthode

Returns the configuration cache.
public getConfigCache ( ) : sfConfigCache
Résultat sfConfigCache A sfConfigCache instance

getConfiguration() public méthode

Returns the configuration instance.
public getConfiguration ( ) : sfApplicationConfiguration
Résultat sfApplicationConfiguration The current application configuration instance

getController() public méthode

Retrieve the controller.
public getController ( ) : sfController
Résultat sfController The current sfController implementation instance.

getDatabaseConnection() public méthode

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.
public getDatabaseConnection ( name $name = 'default' ) : mixed
$name name A database name.
Résultat mixed A database instance.

getDatabaseManager() public méthode

Retrieve the database manager.
public getDatabaseManager ( ) : sfDatabaseManager
Résultat sfDatabaseManager The current sfDatabaseManager instance.

getEventDispatcher() public méthode

Retrieves the current event dispatcher.
public getEventDispatcher ( ) : sfEventDispatcher
Résultat sfEventDispatcher An sfEventDispatcher instance

getI18N() public méthode

Retrieve the i18n instance
public getI18N ( ) : sfI18N
Résultat sfI18N The current sfI18N implementation instance.

getInstance() public static méthode

Retrieves the singleton instance of this class.
public static getInstance ( string $name = null, string $class = __CLASS__ ) : sfContext
$name string The name of the sfContext to retrieve.
$class string The context class to use (sfContext by default)
Résultat sfContext An sfContext implementation instance.

getLogger() public méthode

Retrieve the logger.
public getLogger ( ) : sfLogger
Résultat sfLogger The current sfLogger implementation instance.

getMailer() public méthode

Retrieves the mailer.
public getMailer ( ) : sfMailer
Résultat sfMailer The current sfMailer implementation instance.

getModuleDirectory() public méthode

Retrieve the module directory for this context.
public getModuleDirectory ( ) : string
Résultat string An absolute filesystem path to the directory of the currently executing module, if one is set, otherwise null.

getModuleName() public méthode

Retrieve the module name for this context.
public getModuleName ( ) : string
Résultat string The currently executing module name, if one is set, otherwise null.

getRequest() public méthode

Retrieve the request.
public getRequest ( ) : sfRequest
Résultat sfRequest The current sfRequest implementation instance.

getResponse() public méthode

Retrieve the response.
public getResponse ( ) : sfResponse
Résultat sfResponse The current sfResponse implementation instance.

getRouting() public méthode

Retrieve the routing instance.
public getRouting ( ) : sfRouting
Résultat sfRouting The current sfRouting implementation instance.

getService() public méthode

Retrieves a service from the service container.
public getService ( string $id ) : object
$id string The service identifier
Résultat object The service instance

getServiceContainer() public méthode

Retrieves the service container.
public getServiceContainer ( ) : sfServiceContainer
Résultat sfServiceContainer The current sfServiceContainer implementation instance.

getStorage() public méthode

Retrieve the storage.
public getStorage ( ) : sfStorage
Résultat sfStorage The current sfStorage implementation instance.

getUser() public méthode

Retrieve the user.
public getUser ( ) : sfUser
Résultat sfUser The current sfUser implementation instance.

getViewCacheManager() public méthode

Retrieve the view cache manager
public getViewCacheManager ( ) : sfViewCacheManager
Résultat sfViewCacheManager The current sfViewCacheManager implementation instance.

has() public méthode

Returns true if an object is currently stored in the current context with the given name, false otherwise.
public has ( string $name ) : boolean
$name string The object name
Résultat boolean true if the object is not null, false otherwise

hasInstance() public static méthode

Checks to see if there has been a context created
public static hasInstance ( string $name = null ) : boolean
$name string The name of the sfContext to check for
Résultat boolean true is instanced, otherwise false

initialize() public méthode

Initializes the current sfContext instance.
public initialize ( sfApplicationConfiguration $configuration )
$configuration sfApplicationConfiguration An sfApplicationConfiguration instance

loadFactories() public méthode

Loads the symfony factories.
public loadFactories ( )

offsetExists() public méthode

Returns true if the context object exists (implements the ArrayAccess interface).
public offsetExists ( string $name ) : boolean
$name string The name of the context object
Résultat boolean true if the context object exists, false otherwise

offsetGet() public méthode

Returns the context object associated with the name (implements the ArrayAccess interface).
public offsetGet ( string $name ) : mixed
$name string The offset of the value to get
Résultat mixed The context object if exists, null otherwise

offsetSet() public méthode

Sets the context object associated with the offset (implements the ArrayAccess interface).
public offsetSet ( string $offset, string $value )
$offset string The parameter name
$value string The parameter value

offsetUnset() public méthode

Unsets the context object associated with the offset (implements the ArrayAccess interface).
public offsetUnset ( string $offset )
$offset string The parameter name

set() public méthode

Puts an object in the current context.
public set ( string $name, object $object )
$name string The name of the object to store
$object object The object to store

setMailerConfiguration() public méthode

Set mailer configuration.
public setMailerConfiguration ( array $configuration )
$configuration array

setResponse() public méthode

Set the response object.
public setResponse ( sfResponse $response ) : void
$response sfResponse An sfResponse instance.
Résultat void

setServiceContainerConfiguration() public méthode

Set service ontainer configuration
public setServiceContainerConfiguration ( array $config )
$config array

shutdown() public méthode

Execute the shutdown procedure.
public shutdown ( ) : void
Résultat void

shutdownUserAndStorage() public méthode

Shuts the user/storage down.

switchTo() public static méthode

Sets the current context to something else
public static switchTo ( string $name )
$name string The name of the context to switch to

Property Details

$configuration protected_oe property

protected $configuration

$current protected_oe static_oe property

protected static $current

$dispatcher protected_oe property

protected $dispatcher

$factories protected_oe property

protected $factories

$hasShutdownUserAndStorage protected_oe property

protected $hasShutdownUserAndStorage

$instances protected_oe static_oe property

protected static $instances

$mailerConfiguration protected_oe property

protected $mailerConfiguration

$serviceContainerConfiguration protected_oe property

protected $serviceContainerConfiguration