Class ServiceLocator
Service locator pattern implementation.
-
Nette\Object
-
Nette\ServiceLocator
implements
Nette\IServiceLocator
Methods summary
public
|
|
public
|
#
addService( string $name, mixed $service, boolean $singleton = TRUE, array $options = NULL )
Adds the specified service to the service container.
Adds the specified service to the service container.
Parameters
- $name
string service name
- $service
mixed object, class name or factory callback
- $singleton
boolean is singleton?
- $options
array factory options
Implementation of
|
public
|
#
removeService( $name )
Removes the specified service type from the service container.
Removes the specified service type from the service container.
Implementation of
|
public
mixed
|
#
getService( string $name, array $options = NULL )
Gets the service object of the specified type.
Gets the service object of the specified type.
Parameters
- $name
string service name
- $options
array options in case service is not singleton
Returns
mixed
Implementation of
|
public
boolean
|
#
hasService( string $name, boolean $created = FALSE )
Exists the service?
Parameters
- $name
string service name
- $created
boolean must be created yet?
Returns
boolean
Implementation of
|
public
Nette\IServiceLocator |null
|
#
getParent( )
Returns the parent container if any.
Returns the parent container if any.
Returns
|