Interface \Prado\Util\IBaseBehavior
There are two specific types of behaviors in PRADO: -IClassBehavior is stateless and one instance attaches to multiple owners. The owner is injected as the first parameter argument in behavior implemented methods called on the owner. -IBehavior is stateful and each one instance attaches to one owner.
All public methods and properties in the behavior are inherited by the owners and so IBaseBehavior act like run-time traits.
IBaseBehavior handler "dy" dynamic events their from owners as well. "dy" dynamic events are an optional event system between owners and behaviors. When an owner calls a method starting with "dy", all attached enabled behaviors implementing the dynamic event are raised. For example:
$filteredData = $componentObject->dyFilterData($data);
would automatically call all enabled behaviors attached to $componentObject implementing dyFilterData(..., ?TCallchain $chain = null). The first parameter in "dy" dynamic events is passed through as the return value and so acts like a filter or default return value. When there are no handlers for a dynamic event, the returned value will always be the value of the first method parameter.
"dy" dynamic event methods append a "TCallChain" to the argument lists and the event must be called on with the dynamic event to continue the call chain. Dynamic events work slightly differently between IClassBehavior and IBehavior where the IClassBehavior has the owner object injected as the first method argument and the IBehavior does not. The call chain may be optional to make the dynamic event method callable without the $chain but will always be present in owner called behavior dynamic event methods.
See IBehavior and IClassBehavior for examples of their respective dynamic event implementations.
Author: Brad Anderson <belisoful@icloud.ocm>
Since: 3.2.3
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
init(mixed $config) : mixed
Handles behavior configurations from TBehaviorsModule and TBehaviorParameterLoader.
|
public
|
|
public
|
|
public
|
|
public
|
syncEventHandlers([object|null $component = null ][, null|bool|int $attachOverride = 0 ]) : mixed
Synchronize the $component or all owners' events of the behavior event handlers
by attaching or detaching handlers where needed.
|
getPriority, setPriority |
public
mixed
|
CONFIG_KEY
The array key for the $config data in instancing behaviors with init($config),
|
'=config='
|