abstract class Component implements IComponent

Component is the base class for all components.

Components are objects implementing IComponent. They has parent component and own name.

Properties

string read-only $name
IContainer|null read-only $parent

Methods

__construct()

No description

IComponent|null
lookup($type, $throw = true)

Lookup hierarchy for component specified by class or interface name.

string|null
lookupPath($type = null, $throw = true)

Lookup for component specified by class or interface name. Returns backtrace path.

void
monitor($type)

Starts monitoring.

void
unmonitor($type)

Stops monitoring.

void
attached($obj)

This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.

void
detached($obj)

This method will be called before the component (or component's parent) becomes detached from a monitored object. Do not call this method yourself.

string|null
getName()

No description

IContainer|null
getParent()

Returns the container if any.

setParent(IContainer $parent = null, $name = null)

Sets or removes the parent of this component. This method is managed by containers and should not be called by applications

void
validateParent(IContainer $parent)

Is called by a component when it is about to be set new parent. Descendant can override this method to disallow a parent change by throwing an Nette\InvalidStateException

__clone()

Object cloning.

__sleep()

Prevents serialization.

__wakeup()

Prevents unserialization.

Details

at line 35
__construct()

No description

at line 53
IComponent|null lookup($type, $throw = true)

Lookup hierarchy for component specified by class or interface name.

Parameters

$type
$throw

Return Value

IComponent|null

at line 95
string|null lookupPath($type = null, $throw = true)

Lookup for component specified by class or interface name. Returns backtrace path.

A path is the concatenation of component names separated by self::NAME_SEPARATOR.

Parameters

$type
$throw

Return Value

string|null

at line 107
void monitor($type)

Starts monitoring.

Parameters

$type

Return Value

void

at line 123
void unmonitor($type)

Stops monitoring.

Parameters

$type

Return Value

void

at line 135
protected void attached($obj)

This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.

Parameters

$obj

Return Value

void

at line 146
protected void detached($obj)

This method will be called before the component (or component's parent) becomes detached from a monitored object. Do not call this method yourself.

Parameters

$obj

Return Value

void

at line 157
string|null getName()

No description

Return Value

string|null

at line 167
IContainer|null getParent()

Returns the container if any.

Return Value

IContainer|null

at line 182
IComponent setParent(IContainer $parent = null, $name = null)

internal  
 

Sets or removes the parent of this component. This method is managed by containers and should not be called by applications

Parameters

IContainer $parent
$name

Return Value

IComponent

Exceptions

InvalidStateException

at line 222
protected void validateParent(IContainer $parent)

Is called by a component when it is about to be set new parent. Descendant can override this method to disallow a parent change by throwing an Nette\InvalidStateException

Parameters

IContainer $parent

Return Value

void

Exceptions

InvalidStateException

at line 298
__clone()

Object cloning.

at line 319
__sleep()

Prevents serialization.

at line 328
__wakeup()

Prevents unserialization.

Traits

SmartObject