Component
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
Finds the closest ancestor specified by class or interface name.
Finds the closest ancestor specified by class or interface name and returns backtrace path.
Starts monitoring of ancestors.
Stops monitoring of ancestors.
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
This method will be called before the component (or component's parent) becomes detached from a monitored object. Do not call this method yourself.
No description
Returns the parent container if any.
Sets or removes the parent of this component. This method is managed by containers and should not be called by applications
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
Object cloning.
Prevents serialization.
Prevents unserialization.
Details
at line 39
final IComponent|null
lookup(string|null $type, bool $throw = true)
Finds the closest ancestor specified by class or interface name.
at line 82
final string|null
lookupPath(string|null $type = null, bool $throw = true)
Finds the closest ancestor specified by class or interface name and returns backtrace path.
A path is the concatenation of component names separated by self::NAME_SEPARATOR.
at line 92
final void
monitor(string $type, callable|null $attached = null, callable|null $detached = null)
Starts monitoring of ancestors.
at line 114
final void
unmonitor(string $type)
Stops monitoring of ancestors.
at line 125
protected void
attached(IComponent $obj)
deprecated
deprecated
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
at line 135
protected void
detached(IComponent $obj)
deprecated
deprecated
This method will be called before the component (or component's parent) becomes detached from a monitored object. Do not call this method yourself.
at line 143
final string|null
getName()
No description
at line 152
final IContainer|null
getParent()
Returns the parent container if any.
at line 164
IComponent
setParent(IContainer|null $parent, string|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
at line 204
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
at line 281
__clone()
Object cloning.
at line 301
final
__sleep()
Prevents serialization.
at line 310
final
__wakeup()
Prevents unserialization.
Traits
Strict class for better experience.