コード例 #1
0
 /**
  * Implementation Zend_EventManager_ListenerAggregate
  * 
  * @param \Zend_EventManager_EventCollection $events
  */
 public function attach(\Zend_EventManager_EventCollection $events)
 {
     $this->listeners[] = $events->attach(self::EVENT_PRE, array($this, 'load'), 100);
     $this->listeners[] = $events->attach(self::EVENT_POST, array($this, 'save'), -100);
     $this->listeners[] = $events->attach(self::EVENT_REMOVE, array($this, 'remove'), 50);
     $this->listeners[] = $events->attach(self::EVENT_CLEAN, array($this, 'clean'), 0);
 }
コード例 #2
0
 public function attach(Zend_EventManager_EventCollection $events, $priority = null)
 {
     $this->priority = $priority;
     $listeners = array();
     $listeners[] = $events->attach('foo.bar', array($this, 'fooBar'));
     $listeners[] = $events->attach('foo.baz', array($this, 'fooBaz'));
     $this->listeners[spl_object_hash($events)] = $listeners;
     return __METHOD__;
 }