PHP Class sfContext

Author: Fabien Potencier ([email protected])
Author: Sean Kerr ([email protected])
Inheritance: implements ArrayAccess
ファイルを表示 Open project: lexpress/symfony1 Class Usage Examples

Protected Properties

Property Type Description
$configuration
$current
$dispatcher
$factories
$hasShutdownUserAndStorage
$instances
$mailerConfiguration
$serviceContainerConfiguration

Public Methods

Method 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 method

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
return mixed The returned value of the called method

createInstance() public static method

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)
return sfContext An sfContext instance

dispatch() public method

Dispatches the current request.
public dispatch ( )

filterTemplateParameters() public method

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
return array The filtered parameters array

get() public method

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

getActionName() public method

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

getActionStack() public method

Retrieve the ActionStack.
public getActionStack ( ) : sfActionStack
return sfActionStack the sfActionStack instance

getConfigCache() public method

Returns the configuration cache.
public getConfigCache ( ) : sfConfigCache
return sfConfigCache A sfConfigCache instance

getConfiguration() public method

Returns the configuration instance.
public getConfiguration ( ) : sfApplicationConfiguration
return sfApplicationConfiguration The current application configuration instance

getController() public method

Retrieve the controller.
public getController ( ) : sfController
return sfController The current sfController implementation instance.

getDatabaseConnection() public method

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.
return mixed A database instance.

getDatabaseManager() public method

Retrieve the database manager.
public getDatabaseManager ( ) : sfDatabaseManager
return sfDatabaseManager The current sfDatabaseManager instance.

getEventDispatcher() public method

Retrieves the current event dispatcher.
public getEventDispatcher ( ) : sfEventDispatcher
return sfEventDispatcher An sfEventDispatcher instance

getI18N() public method

Retrieve the i18n instance
public getI18N ( ) : sfI18N
return sfI18N The current sfI18N implementation instance.

getInstance() public static method

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)
return sfContext An sfContext implementation instance.

getLogger() public method

Retrieve the logger.
public getLogger ( ) : sfLogger
return sfLogger The current sfLogger implementation instance.

getMailer() public method

Retrieves the mailer.
public getMailer ( ) : sfMailer
return sfMailer The current sfMailer implementation instance.

getModuleDirectory() public method

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

getModuleName() public method

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

getRequest() public method

Retrieve the request.
public getRequest ( ) : sfRequest
return sfRequest The current sfRequest implementation instance.

getResponse() public method

Retrieve the response.
public getResponse ( ) : sfResponse
return sfResponse The current sfResponse implementation instance.

getRouting() public method

Retrieve the routing instance.
public getRouting ( ) : sfRouting
return sfRouting The current sfRouting implementation instance.

getService() public method

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

getServiceContainer() public method

Retrieves the service container.
public getServiceContainer ( ) : sfServiceContainer
return sfServiceContainer The current sfServiceContainer implementation instance.

getStorage() public method

Retrieve the storage.
public getStorage ( ) : sfStorage
return sfStorage The current sfStorage implementation instance.

getUser() public method

Retrieve the user.
public getUser ( ) : sfUser
return sfUser The current sfUser implementation instance.

getViewCacheManager() public method

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

has() public method

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
return boolean true if the object is not null, false otherwise

hasInstance() public static method

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
return boolean true is instanced, otherwise false

initialize() public method

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

loadFactories() public method

Loads the symfony factories.
public loadFactories ( )

offsetExists() public method

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

offsetGet() public method

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
return mixed The context object if exists, null otherwise

offsetSet() public method

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 method

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

set() public method

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 method

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

setResponse() public method

Set the response object.
public setResponse ( sfResponse $response ) : void
$response sfResponse An sfResponse instance.
return void

setServiceContainerConfiguration() public method

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

shutdown() public method

Execute the shutdown procedure.
public shutdown ( ) : void
return void

shutdownUserAndStorage() public method

Shuts the user/storage down.

switchTo() public static method

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