EventManager/StaticEventManager.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_EventManager  

\Zend_EventManager_StaticEventManager

Package: Zend\EventManager
Static version of EventManager

Allows attaching to EMs composed by other classes without having an instance first. The assumption is that the SharedEventManager will be injected into EventManager instances, and then queried for additional listeners when triggering an event.

Parent(s)
\Zend_EventManager_SharedEventManager
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedarray $identifiers = array()
inherited
Identifiers with event connections
Inherited from: \Zend_EventManager_SharedEventManager::$$identifiers
Default valuearray()Details
Type
array
Inherited_from
\Zend_EventManager_SharedEventManager::$$identifiers  
>VPropertyprotected\Zend_EventManager_StaticEventManager $instance
static

Methods

methodprivate__clone() : void

Singleton

methodprotected__construct() : void

Singleton

methodpublicattach(string | array $id, string $event, callback $callback, int $priority = 1) : void
inherited

Attach a listener to an event

Inherited from: \Zend_EventManager_SharedEventManager::attach()

Allows attaching a callback to an event offerred by one or more identifying components. As an example, the following connects to the "getAll" event of both an AbstractResource and EntityResource:

SharedEventManager::getInstance()->connect(
    array('My\Resource\AbstractResource', 'My\Resource\EntityResource'),
    'getOne',
    function ($e) use ($cache) {
        if (!$id = $e->getParam('id', false)) {
            return;
        }
        if (!$data = $cache->load(get_class($resource) . '::getOne::' . $id )) {
            return;
        }
        return $data;
    }
);
Parameters
NameTypeDescription
$idstring | array

Identifier(s) for event emitting component(s)

$eventstring
$callbackcallback

PHP Callback

$priorityint

Priority at which listener should execute

methodpublicclearListeners(string | int $id, null | string $event = null) : bool
inherited

Clear all listeners for a given identifier, optionally for a specific event

Inherited from: \Zend_EventManager_SharedEventManager::clearListeners()
Parameters
NameTypeDescription
$idstring | int
$eventnull | string
Returns
TypeDescription
bool
methodpublicdetach(string | int $id, \Zend_Stdlib_CallbackHandler $listener) : bool
inherited

Detach a listener from an event offered by a given resource

Inherited from: \Zend_EventManager_SharedEventManager::detach()
Parameters
NameTypeDescription
$idstring | int
$listener\Zend_Stdlib_CallbackHandler
Returns
TypeDescription
boolReturns true if event and listener found, and unsubscribed; returns false if either event or listener not found
methodpublicgetEvents(string | int $id) : array
inherited

Retrieve all registered events for a given resource

Inherited from: \Zend_EventManager_SharedEventManager::getEvents()
Parameters
NameTypeDescription
$idstring | int
Returns
TypeDescription
array
methodpublicgetInstance() : \Zend_EventManager_StaticEventManager
static

Retrieve instance

methodpublicgetListeners(string | int $id, string | int $event) : false | \Zend_Stdlib_PriorityQueue
inherited

Retrieve all listeners for a given identifier and event

Inherited from: \Zend_EventManager_SharedEventManager::getListeners()
Parameters
NameTypeDescription
$idstring | int
$eventstring | int
Returns
TypeDescription
false | \Zend_Stdlib_PriorityQueue
methodpublicresetInstance() : void
static

Reset the singleton instance

Documentation was generated by phpDocumentor 2.0.0a12.