abstract class PresenterComponent extends ComponentContainer implements ISignalReceiver, IStatePersistent, ArrayAccess

PresenterComponent is the base class for all presenters components.

Components are persistent objects located on a presenter. They have ability to own other child components, and interact with user. Components have properties for storing their status, and responds to user command.

Properties

protected array $params
Presenter read-only $presenter

Methods

__construct(IComponentContainer $parent = NULL, $name = NULL)

No description

Presenter|null
getPresenter($need = TRUE)

Returns the presenter where this component belongs to.

string
getUniqueId()

Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.

void
attached($presenter)

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

bool
tryCall($method, array $params)

Calls public method if exists.

void
loadState(array $params)

Loads state informations.

void
saveState(array $params, $forClass = NULL)

Saves state informations for next request.

mixed
getParam($name = NULL, $default = NULL)

Returns component param.

string
getParamId($name)

Returns a fully-qualified name that uniquely identifies the parameter.

static array
getPersistentParams()

Returns array of classes persistent parameters. They have public visibility and are non-static.

void
signalReceived($signal)

Calls signal handler method.

string
formatSignalMethod($signal)

Formats signal handler method name -> case sensitivity doesn't matter.

string
link($destination, $args = array())

Generates URL to presenter, action or signal.

lazyLink($destination, $args = array())

Returns destination as Link object.

ajaxLink($destination, $args = array()) deprecated

No description

void
redirect($code, $destination = NULL, $args = array())

Redirect to another presenter, action or signal.

offsetSet($name, $component)

Adds the component to the container.

IComponent
offsetGet($name)

Returns component specified by name. Throws exception if component doesn't exist.

bool
offsetExists($name)

Does component specified by name exists?

void
offsetUnset($name)

Removes component from the container. Throws exception if component doesn't exist.

Details

at line 54
__construct(IComponentContainer $parent = NULL, $name = NULL)

No description

Parameters

IComponentContainer $parent
$name

at line 67
Presenter|null getPresenter($need = TRUE)

Returns the presenter where this component belongs to.

Parameters

$need

Return Value

Presenter|null

at line 79
string getUniqueId()

Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.

Return Value

string

at line 92
protected void attached($presenter)

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

$presenter

Return Value

void

at line 107
protected bool tryCall($method, array $params)

Calls public method if exists.

Parameters

$method
array $params

Return Value

bool

does method exist?

at line 129
void loadState(array $params)

Loads state informations.

Parameters

array $params

Return Value

void

at line 151
void saveState(array $params, $forClass = NULL)

Saves state informations for next request.

Parameters

array $params
$forClass

Return Value

void

at line 192
final mixed getParam($name = NULL, $default = NULL)

Returns component param.

If no key is passed, returns the entire array.

Parameters

$name
$default

Return Value

mixed

at line 211
final string getParamId($name)

Returns a fully-qualified name that uniquely identifies the parameter.

Parameters

$name

Return Value

string

at line 224
static array getPersistentParams()

Returns array of classes persistent parameters. They have public visibility and are non-static.

This default implementation detects persistent parameters by annotation @persistent.

Return Value

array

at line 248
void signalReceived($signal)

Calls signal handler method.

Parameters

$signal

Return Value

void

Exceptions

BadSignalException

at line 262
string formatSignalMethod($signal)

Formats signal handler method name -> case sensitivity doesn't matter.

Parameters

$signal

Return Value

string

Generates URL to presenter, action or signal.

Parameters

$destination
$args

Return Value

string

Exceptions

InvalidLinkException

Returns destination as Link object.

Parameters

$destination
$args

Return Value

Link

deprecated

No description

Parameters

$destination
$args

at line 333
void redirect($code, $destination = NULL, $args = array())

Redirect to another presenter, action or signal.

Parameters

$code
$destination
$args

Return Value

void

Exceptions

AbortException

at line 362
final offsetSet($name, $component)

Adds the component to the container.

Parameters

$name
$component

at line 375
final IComponent offsetGet($name)

Returns component specified by name. Throws exception if component doesn't exist.

Parameters

$name

Return Value

IComponent

Exceptions

InvalidArgumentException

at line 387
final bool offsetExists($name)

Does component specified by name exists?

Parameters

$name

Return Value

bool

at line 399
final void offsetUnset($name)

Removes component from the container. Throws exception if component doesn't exist.

Parameters

$name

Return Value

void