public function events($events=array())
    {
        if (!isset($this->_events)) {
            $this->_events = new Events(array(), self::schema()->events());
            $this->_registerDefaultEventHandlers();
        }

        if(count($events))
            foreach($events as $event=>$callback)
                $this->_events->register($event, $callback);

        return $this->_events;
    }
public function events($events=array())
    {
        if (!isset($this->_events)) {
            $this->_events = new Events(array(), self::schema()->events());
            $this->_registerDefaultEventHandlers();
        }

        if(count($events))
            foreach($events as $event=>$callback)
                $this->_events->register($event, $callback);

        return $this->_events;
    }
public function events ( $ events = array ( ) ) { if ( ! isset ( $ this -> _events ) ) { $ this -> _events = new Events ( array ( ) , self :: schema ( ) -> events ( ) ) ; $ this -> _registerDefaultEventHandlers ( ) ; } if ( count ( $ events ) ) foreach ( $ events as $ event => $ callback ) $ this -> _events -> register ( $ event , $ callback ) ; return $ this -> _events ; }
Returns the domain objects event collection, optionally registering any passed
events
@return Events
Returns the domain objects event collection optionally registering any passed events