Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Utils
  • none
  • Tracy
    • Bridges
      • Nette

Classes

  • Compiler
  • CompilerExtension
  • Container
  • ContainerBuilder
  • ContainerFactory
  • ContainerLoader
  • 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
Located at DI/Container.php
Methods summary
public
# __construct( array $params = array() )
public array
# getParameters( )

Returns

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

Adds the service to the container.

Adds the service to the container.

Parameters

$name
$service

Returns

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

Removes the service from the container.

Removes the service from the container.

Parameters

$name
public object
# getService( string $name )

Gets the service object by name.

Gets the service object by name.

Parameters

$name

Returns

object
object

Throws

Nette\DI\MissingServiceException
MissingServiceException
public string
# getServiceType( string $name )

Gets the service type by name.

Gets the service type by name.

Parameters

$name

Returns

string
string

Throws

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

Does the service exist?

Does the service exist?

Parameters

$name
name

Returns

boolean
bool
public boolean
# isCreated( string $name )

Is the service created?

Is the service created?

Parameters

$name
name

Returns

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

Creates new instance of the service.

Creates new instance of the service.

Parameters

$name
name
$args

Returns

object
object

Throws

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

Resolves service by type.

Resolves service by type.

Parameters

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

Returns

object
service or NULL

Throws

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

Gets the service names of the specified type.

Gets the service names of the specified type.

Parameters

$class

Returns

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

Gets the service names of the specified tag.

Gets the service names of the specified tag.

Parameters

$tag

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
class
$args
arguments

Returns

object
object

Throws

Nette\InvalidArgumentException
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
public mixed
# callMethod( $function, array $args = array() )

Calls method using autowiring.

Calls method using autowiring.

Returns

mixed
mixed
public mixed
# expand( mixed $s )

Expands %placeholders%.

Expands %placeholders%.

Deprecated

Parameters

$s

Returns

mixed
mixed
public mixed &
# __get( string $name )

Deprecated

Parameters

$name
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
name
$service
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
name

Returns

boolean
bool

Overrides

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

Deprecated

Parameters

$name
name

Throws

MemberAccessException
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'
string SERVICES
#'services'
string ALIASES
#'aliases'
Properties summary
public array $parameters
#array()
protected array[] $meta
#array()
Magic properties inherited from Nette\Object
$reflection
Nette 2.3-20161221 API API documentation generated by ApiGen 2.8.0