5.1.1.2. Baleen\Migrations\Event\HasEmitterTrait

trait HasEmitterTrait

Trait to be used by classes that fire events through a specialised emitter. For example, the Timeline class will use this trait to fire events using the TimelineEmitter.

property emitter

protected PublisherInterface

setEventDispatcher(EventDispatcherInterface $eventDispatcher)

Set the EventDispatcher for the emitter. This is public to allow attaching a previously existing EventDispatcher.

Parameters:
  • $eventDispatcher (EventDispatcherInterface) –
getEmitter()

Returns the emitter for the class. Creates one if necessary.

Returns:PublisherInterface
setEmitter(PublisherInterface $emitter)

Sets the emitter for the class.

Parameters:
createEmitter()

Must create and return a default emitter.

Returns:PublisherInterface
getEventDispatcher()

Get the event dispatcher from the emitter.

Returns:EventDispatcherInterface