Path

ez components / documentation / api reference / 2008.2.3 / signalslot


eZ Components 2008.2.3

SignalSlot: ezcSignalStaticConnections

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcSignalStaticConnections

ezcSignalStaticConnections makes it possible to connect to signals through the signals identifier. [source]

Implemented Interfaces

The static connections allow you to:
  • connect to a signal sent by any object signal collection with the same identifier. Usually the identifier is set to the name of the class holding the collection. Using the static connections you can connect to a signal sent by any object of that class.
  • connect to a signal that does not yet exist. This allows you to delay initialization of the emitting object until it is needed.

Properties

array read/write  $connections
Holds the internal structure of signals. The format is array( identifier => array( signalName => array(priority=>array(slots)) ) ). It can be both read and set in order to provide easy setup of the static connections from disk.

Method Summary

public void connect( $identifier, $signal, $slot, [$priority = 1000] )
Connects the signal $signal emited by any ezcSignalCollection with the identifier $identifier to the slot $slot.
public void disconnect( $identifier, $signal, $slot, [$priority = null] )
Disconnects the $slot from the $signal with identifier $identifier..
public array(int=>array(callback)) getConnections( $identifier, $signal )
Returns all the connections for signals $signal in signal collections with the identifier $identifier.
public static ezcConfigurationManager getInstance( )
Returns the instance of the ezcSignalStaticConnections..
public mixed __get( $name )
Returns the property $name.
public void __set( $name, $value )
Sets the property $name to $value.

Methods

connect

void connect( string $identifier, string $signal, callback $slot, [int $priority = 1000] )
Connects the signal $signal emited by any ezcSignalCollection with the identifier $identifier to the slot $slot.
To control the order in which slots are called you can set a priority from 1 - 65 536. The lower the number the higher the priority. The default priority is 1000. Slots with the same priority may be called with in any order.
A slot will be called once for every time it is connected. It is possible to connect a slot more than once.
See the PHP documentation for examples on the callback type. http://php.net/callback
We reccommend avoiding excessive usage of the $priority parameter since it makes it much harder to track how your program works.

Parameters

Name Type Description
$identifier string  
$signal string  
$slot callback  
$priority int  

disconnect

void disconnect( string $identifier, string $signal, callback $slot, [int $priority = null] )
Disconnects the $slot from the $signal with identifier $identifier..
If the priority is given it will try to disconnect a slot with that priority. If no such slot is found no slot will be disconnected.
If no priority is given it will disconnect the matching slot with the lowest priority.

Parameters

Name Type Description
$identifier string  
$signal string  
$slot callback  
$priority int  

getConnections

array(int=>array(callback)) getConnections( string $identifier, string $signal )
Returns all the connections for signals $signal in signal collections with the identifier $identifier.

Parameters

Name Type Description
$identifier string  
$signal string  

getInstance

ezcConfigurationManager getInstance( )
Returns the instance of the ezcSignalStaticConnections..

__get

mixed __get( string $name )
Returns the property $name.

Parameters

Name Type Description
$name string  

Throws

ClassDescription
ezcBasePropertyNotFoundException if the property does not exist.

__set

void __set( string $name, mixed $value )
Sets the property $name to $value.

Parameters

Name Type Description
$name string  
$value mixed  

Throws

ClassDescription
ezcBasePropertyNotFoundException if the property does not exist.

Last updated: Mon, 11 May 2009