Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • ArrayTools
  • Callback
  • Component
  • ComponentContainer
  • Configurator
  • DateTime
  • Debug
  • Environment
  • Framework
  • FreezableObject
  • GenericRecursiveIterator
  • Image
  • ImageMagick
  • InstanceFilterIterator
  • Object
  • ObjectMixin
  • Paginator
  • RecursiveComponentIterator
  • ServiceLocator
  • SmartCachingIterator
  • String
  • Tools

Interfaces

  • IComponent
  • IComponentContainer
  • IDebuggable
  • IServiceLocator
  • ITranslator

Exceptions

  • AmbiguousServiceException
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases

Class ServiceLocator

Service locator pattern implementation.

Nette\Object
Extended by Nette\ServiceLocator implements Nette\IServiceLocator
Namespace: Nette
Author: David Grudl
Located at Environment/ServiceLocator.php
Methods summary
public
# __construct( Nette\IServiceLocator $parent = NULL )

Parameters

$parent
Nette\IServiceLocator
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

Nette\IServiceLocator::addService
public
# removeService( $name )

Removes the specified service type from the service container.

Removes the specified service type from the service container.

Implementation of

Nette\IServiceLocator::removeService
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

Nette\IServiceLocator::getService
public boolean
# hasService( string $name, boolean $created = FALSE )

Exists the service?

Exists the service?

Parameters

$name
string
service name
$created
boolean
must be created yet?

Returns

boolean

Implementation of

Nette\IServiceLocator::hasService
public Nette\IServiceLocator|null
# getParent( )

Returns the parent container if any.

Returns the parent container if any.

Returns

Nette\IServiceLocator|null
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0