perfectin/domain

TYPO3 Flow package to use for domain events

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:typo3-flow-framework

dev-master 2014-06-26 21:06 UTC

This package is not auto-updated.

Last update: 2024-11-09 16:08:43 UTC


README

PerfectIn.Domain is TYPO3.Flow package for supporting domain events.

  • Event publishing without any dependencies
  • Event subscription without any depedencies

Trigger domain event


use PerfectIn\App\Domain\Event as Event;

function doSomething($something) {
 	$event = new Event\SomethingHappenedEvent($something);
s}

Domain event

  • needs annotiation @PerfectIn\Domain\Annotations\Event
  • annotation option: publish => to automatically publish event after construction (default=true)
  • annotation option: persist => to automatically persist (TODO!) event after construction (default=false)

namespace PerfectIn\App\Domain\Event;

use PerfectIn\Domain\Annotations as Domain;

/**
 * something happened event
 * 
 * @Domain\Event
 */
class SomethingHappenedEvent  {

}

Example Subscribe to domain event

  • needs annotiation @PerfectIn\Domain\Annotations\Subscribe("classnameOfDomainEvent")

use PerfectIn\Domain\Annotations as Domain;
use PerfectIn\App\Domain\Event as Event;

/**
 * @Domain\Subscribe("PerfectIn\App\Domain\Event\SomethingHappenedEvent")
 * @param Event\SomethingHappenedEvent $somethingHappenedEvent
 */
public function logSomethingHappened(Event\SomethingHappenedEvent $somethingHappenedEvent) {

}