Overview

Namespaces

  • NGS
    • Client
      • Exception
    • Converter
    • Patterns
  • PHP

Classes

  • AggregateDomainEvent
  • AggregateRoot
  • CubeBuilder
  • DomainEvent
  • GenericSearch
  • Identifiable
  • OlapCube
  • Repository
  • Search
  • Searchable
  • SearchBuilder
  • Snapshot
  • Specification
  • Templater

Interfaces

  • IDomainObject
  • IIdentifiable
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: namespace NGS\Patterns;
 3: 
 4: require_once(__DIR__.'/../Client/DomainProxy.php');
 5: 
 6: use NGS\Client\DomainProxy;
 7: 
 8: /**
 9:  * Domain event represents an meaningful business event that occurred in the system.
10:  * It is a message that back-end system knows how to process and that will
11:  * change the state of the system.
12:  * <p>
13:  * They are preferred way of manipulating data instead of simple CRUD
14:  * operations (create, update, delete).
15:  * Unlike {@see AggregateDomainEvent} which is tied to a change in a single
16:  * {@see AggregateRoot}, DomainEvent should be used when an action will result
17:  * in modifications to multiple aggregates, external call (like sending an email)
18:  * or some other action.
19:  * <p>
20:  * By default event will be applied immediately.
21:  * If {@code async} is used, event will be stored immediately but applied later.
22:  *
23:  * DomainEvent is defined in DSL with keyword {@code event}.
24:  *
25:  * <blockquote><pre>
26:  * module Todo {
27:  * aggregate Task;
28:  * event MarkDone {
29:  * Task task;
30:  * }
31:  * }
32:  * </pre></blockquote>
33:  */
34: abstract class DomainEvent
35: {
36:     /**
37:      * Submits event
38:      *
39:      * @return string Created event URI
40:      */
41:     public function submit()
42:     {
43:         $eventUri = DomainProxy::instance()->submitEvent($this);
44:         if (is_string($eventUri)) {
45:             $this->URI = $eventUri;
46:         }
47:         return $eventUri;
48:     }
49: }
50: 
API documentation generated by ApiGen 2.8.0