Packages

  • Nette
    • Application
      • Application\Diagnostics
      • Application\Responses
      • Application\Routers
      • Application\UI
    • Caching
      • Caching\Storages
    • ComponentModel
    • Config
    • Database
      • Database\Diagnostics
      • Database\Drivers
      • Database\Reflection
      • Database\Table
    • DI
    • Diagnostics
    • Forms
      • Forms\Controls
      • Forms\Rendering
    • Http
    • Iterators
    • Latte
      • Latte\Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • None
  • PHP

Classes

  • DIContainer
  • DIContainerBuilder
  • ServiceBuilder

Interfaces

  • IDIContainer
  • IServiceBuilder

Exceptions

  • AmbiguousServiceException
  • MissingServiceException
  • Overview
  • Package
  • Class
  • Tree

Class DIContainer

The dependency injection container default implementation.

Object
Extended by FreezableObject implements IFreezable
Extended by DIContainer implements IDIContainer
Package: Nette\DI
Author: David Grudl
Located at DI/Container.php
Methods summary
public DIContainer|ServiceBuilder
# addService( string $name, mixed $service, mixed $tags = NULL )

Adds the specified service or service factory to the container.

Adds the specified service or service factory to the container.

Parameters

$name
string
$service
mixed
object, class name or callback
$tags
mixed
array of tags or string typeHint

Returns

DIContainer|ServiceBuilder
provides a fluent interface

Implementation of

IDIContainer::addService
public
# removeService( string $name )

Removes the specified service type from the container.

Removes the specified service type from the container.

Parameters

$name
string

Implementation of

IDIContainer::removeService
public object
# getService( string $name )

Gets the service object by name.

Gets the service object by name.

Parameters

$name
string

Returns

object

Implementation of

IDIContainer::getService
public object
# getServiceByType( string $type )

Gets the service object of the specified type.

Gets the service object of the specified type.

Parameters

$type
string

Returns

object
public array
# getServiceNamesByTag( string $tag )

Gets the service objects of the specified tag.

Gets the service objects of the specified tag.

Parameters

$tag
string

Returns

array
of [service name => tag attributes]
public boolean
# hasService( string $name )

Does the service exist?

Does the service exist?

Parameters

$name
string
service name

Returns

boolean

Implementation of

IDIContainer::hasService
public boolean
# checkServiceType( string $name, string $type )

Checks the service type.

Checks the service type.

Parameters

$name
string
$type
string

Returns

boolean
public mixed
# expand( mixed $s )

Expands %placeholders% in string.

Expands %placeholders% in string.

Parameters

$s
mixed

Returns

mixed
public object &
# __get( string $name )

Gets the service object, shortcut for getService().

Gets the service object, shortcut for getService().

Parameters

$name
string

Returns

object

Throws

MemberAccessException
if the property is not defined.
public
# __set( string $name, object $service )

Adds the service object.

Adds the service object.

Parameters

$name
string
$service
object

Throws

MemberAccessException
if the property is not defined or is read-only
public boolean
# __isset( string $name )

Does the service exist?

Does the service exist?

Parameters

$name
string

Returns

boolean
public
# __unset( string $name )

Removes the service, shortcut for removeService().

Removes the service, shortcut for removeService().

Parameters

$name
string
property name

Throws

MemberAccessException
Methods inherited from FreezableObject
__clone(), freeze(), isFrozen(), updating()
Methods inherited from Object
__call(), __callStatic(), extensionMethod(), getReflection()
Constants summary
string TAG_TYPEHINT 'typeHint'
#
Properties summary
public array $params array()
#

user parameters

user parameters

Nette Framework 2.0beta1 (for PHP 5.2) API API documentation generated by ApiGen 2.3.0