Class Component (namespace Nette)


Component is the base class for all components.

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

Object
   |
   --Component

Implements interfaces:

Direct Known Sub-classes:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Abstract:
Located: in /Component.php (line 39)
Public Method Summary
Component
__construct ([IComponentContainer $parent = NULL], [$name = NULL])
string
getName ()
IComponentContainer|NULL
Returns the container if any.
object
getService (string $type)
Gets the service (experimental).
IServiceLocator
Gets the service locator (experimental).
IComponent
lookup (string $type, [bool $need = TRUE])
Lookup hierarchy for component specified by class or interface name.
string
lookupPath (string $type, [bool $need = TRUE])
Lookup for component specified by class or interface name. Returns backtrace path.
void
monitor (string $type)
Starts monitoring.
void
setParent ([IComponentContainer $parent = NULL], [string $name = NULL])
Sets the parent of this component. This method is managed by containers and should.
void
Sets the service location (experimental).
void
__clone ()
Object cloning.
void
Prevents unserialization.
Protected Method Summary
protected void
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
protected void
This method will be called before the component (or component's parent) becomes detached from a monitored object. Do not call this method yourself.
protected void
Is called by a component when it is about to be set new parent. Descendant can
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()

Method Details

line 57

__construct

public Component __construct ([IComponentContainer $parent = NULL], [$name = NULL])

Input
IComponentContainer $parent
$name
Output
Component  

line 152

attached

protected void attached (IComponent $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.

Input
IComponent $obj
Output
void  

line 164

detached

protected void detached (IComponent $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.

Input
IComponent $obj
Output
void  

line 177

getName

public string getName ()

Implementation of:

Output
string  

line 188

getParent

public IComponentContainer|NULL getParent ()

Returns the container if any.

Implementation of:

Output
IComponentContainer|NULL  

line 344

getService

public object getService (string $type)

Gets the service (experimental).

Input
string $type
Output
object  

line 326

getServiceLocator

public IServiceLocator getServiceLocator ()

Gets the service locator (experimental).

Implementation of:

Output
IServiceLocator  

line 75

lookup

public IComponent lookup (string $type, [bool $need = TRUE])

Lookup hierarchy for component specified by class or interface name.

Input
string $type class/interface type
bool $need throw exception if component doesn't exist?
Output
IComponent  

line 123

lookupPath

public string lookupPath (string $type, [bool $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.

Input
string $type class/interface type
bool $need throw exception if component doesn't exist?
Output
string  

line 137

monitor

public void monitor (string $type)

Starts monitoring.

Input
string $type class/interface type
Output
void  

line 204

setParent

public void setParent ([IComponentContainer $parent = NULL], [string $name = NULL])

Sets the parent of this component. This method is managed by containers and should.

not be called by applications

Overridden in child classes as:

Implementation of:

Input
IComponentContainer $parent New parent or null if this component is being removed from a parent
string $name
Output
void  
Throws
throws InvalidStateException

line 315

setServiceLocator

public void setServiceLocator (IServiceLocator $locator)

Sets the service location (experimental).

Implementation of:

Input
IServiceLocator $locator
Output
void  

line 253

validateParent

protected void validateParent (IComponentContainer $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 \InvalidStateException

Input
IComponentContainer $parent
Output
void  
Throws
throws InvalidStateException

line 358

__clone

public void __clone ()

Object cloning.

Overridden in child classes as:

Output
void  

line 380

__wakeup

public void __wakeup ()

Prevents unserialization.

Output
void