abstract class Component extends Object 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(IContainer $parent = NULL, $name = NULL)

No description

lookup($type, $need = TRUE)

Lookup hierarchy for component specified by class or interface name.

string
lookupPath($type = NULL, $need = 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
getName()

No description

IContainer|null
getParent()

Returns the container if any.

void
setParent(IContainer $parent = NULL, $name = NULL)

Sets 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 33
__construct(IContainer $parent = NULL, $name = NULL)

No description

Parameters

IContainer $parent
$name

at line 50
IComponent lookup($type, $need = TRUE)

Lookup hierarchy for component specified by class or interface name.

Parameters

$type
$need

Return Value

IComponent

at line 92
string lookupPath($type = NULL, $need = 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
$need

Return Value

string

at line 104
void monitor($type)

Starts monitoring.

Parameters

$type

Return Value

void

at line 120
void unmonitor($type)

Stops monitoring.

Parameters

$type

Return Value

void

at line 132
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 143
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 154
string getName()

No description

Return Value

string

at line 164
IContainer|null getParent()

Returns the container if any.

Return Value

IContainer|null

at line 179
void setParent(IContainer $parent = NULL, $name = NULL)

internal  
 

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

Parameters

IContainer $parent
$name

Return Value

void

Exceptions

InvalidStateException

at line 219
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 295
__clone()

Object cloning.

at line 316
__sleep()

Prevents serialization.

at line 325
__wakeup()

Prevents unserialization.