Namespaces

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

Classes

  • Compiler
  • CompilerExtension
  • Container
  • ContainerBuilder
  • ServiceDefinition
  • Statement

Exceptions

  • MissingServiceException
  • ServiceCreationException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Container

The dependency injection container default implementation.

Nette\Object
Extended by Nette\DI\Container
Namespace: Nette\DI
Author: David Grudl
Located at DI/Container.php
Methods summary
public
# __construct( array $params = array() )
public array
# getParameters( )

Returns

array
public Nette\DI\Container
# addService( string $name, object $service )

Adds the service to the container.

Adds the service to the container.

Parameters

$name
string
$service
object

Returns

Nette\DI\Container
public
# removeService( string $name )

Removes the service from the container.

Removes the service from the container.

Parameters

$name
string
public object
# getService( string $name )

Gets the service object by name.

Gets the service object by name.

Parameters

$name
string

Returns

object

Throws

Nette\DI\MissingServiceException
public boolean
# hasService( string $name )

Does the service exist?

Does the service exist?

Parameters

$name
string
service name

Returns

boolean
public boolean
# isCreated( string $name )

Is the service created?

Is the service created?

Parameters

$name
string
service name

Returns

boolean
public object
# createService( string $name, array $args = array() )

Creates new instance of the service.

Creates new instance of the service.

Parameters

$name
string
service name
$args

Returns

object

Throws

Nette\DI\MissingServiceException
public object
# getByType( string $class, boolean $need = TRUE )

Resolves service by type.

Resolves service by type.

Parameters

$class
string
class or interface
$need
boolean
throw exception if service doesn't exist?

Returns

object
service or NULL

Throws

Nette\DI\MissingServiceException
public string[]
# findByType( string $class )

Gets the service names of the specified type.

Gets the service names of the specified type.

Parameters

$class
string

Returns

string[]
public array
# findByTag( string $tag )

Gets the service names of the specified tag.

Gets the service names of the specified tag.

Parameters

$tag
string

Returns

array
of [service name => tag attributes]
public object
# createInstance( string $class, array $args = array() )

Creates new instance using autowiring.

Creates new instance using autowiring.

Parameters

$class
string
class
$args
array
arguments

Returns

object

Throws

Nette\InvalidArgumentException
public
# callInjects( object $service )

Calls all methods starting with with "inject" using autowiring.

Calls all methods starting with with "inject" using autowiring.

Parameters

$service
object
public mixed
# callMethod( mixed $function, array $args = array() )

Calls method using autowiring.

Calls method using autowiring.

Parameters

$function
mixed
class, object, function, callable
$args
array
arguments

Returns

mixed
public mixed
# expand( mixed $s )

Expands %placeholders%.

Expands %placeholders%.

Parameters

$s
mixed

Returns

mixed
public mixed &
# __get( string $name )

Deprecated

Parameters

$name
string
property name

Returns

mixed
property value

Throws

MemberAccessException
if the property is not defined.

Overrides

Nette\Object::__get()
public
# __set( string $name, mixed $service )

Deprecated

Parameters

$name
string
property name
$service
mixed
property value

Throws

MemberAccessException
if the property is not defined or is read-only

Overrides

Nette\Object::__set()
public boolean
# __isset( string $name )

Deprecated

Parameters

$name
string
property name

Returns

boolean

Overrides

Nette\Object::__isset()
public
# __unset( string $name )

Deprecated

Parameters

$name
string
property name

Throws

MemberAccessException

Overrides

Nette\Object::__unset()
public static
# getMethodName( $name )
Methods inherited from Nette\Object
__call(), __callStatic(), extensionMethod(), getReflection()
Constants summary
string TAGS 'tags'
#
string TYPES 'types'
#
Properties summary
public array $parameters array()
#
protected array[] $meta array()
#
Magic properties inherited from Nette\Object
$reflection
Nette 2.1 API documentation generated by ApiGen 2.8.0