1 | <?php |
||
13 | final class EventLog extends AbstractAggregateRoot |
||
14 | { |
||
15 | /** |
||
16 | * @var mixed This will depend on how you save the object |
||
17 | */ |
||
18 | private $id; |
||
19 | |||
20 | /** |
||
21 | * @var mixed Identifier of the aggregate root |
||
22 | */ |
||
23 | private $aggregateRootId; |
||
24 | |||
25 | /** |
||
26 | * Type of aggregate root. It should be a unique string that identify an aggregate root type. |
||
27 | * For instance, you may use the Fully-Qualified Class Name. |
||
28 | * Combined with the aggregate root id, you can point to a specific domain object. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private $aggregateRootType; |
||
33 | |||
34 | /** |
||
35 | * The event name. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | private $eventName; |
||
40 | |||
41 | /** |
||
42 | * Events have some properties that vary depending on the event class. |
||
43 | * These properties need to be stored. |
||
44 | * |
||
45 | * @var string The event serialized |
||
46 | */ |
||
47 | private $metadata; |
||
48 | |||
49 | /** |
||
50 | * Who request the action. |
||
51 | * |
||
52 | * @var Author |
||
53 | */ |
||
54 | private $author; |
||
55 | |||
56 | /** |
||
57 | * @var DateTime |
||
58 | */ |
||
59 | private $occurredAt; |
||
60 | |||
61 | /** |
||
62 | * @param mixed $aggregateRootId |
||
63 | * @param string $aggregateRootType |
||
64 | * @param Author $author |
||
65 | * @param string $eventName |
||
66 | * @param DateTime $occurredAt |
||
67 | * @param string $metadata |
||
68 | */ |
||
69 | private function __construct( |
||
87 | |||
88 | /** |
||
89 | * @param AbstractEvent $event |
||
90 | * |
||
91 | * @return EventLog |
||
92 | */ |
||
93 | public static function addEventEntry(AbstractEvent $event) |
||
104 | |||
105 | /** |
||
106 | * Get the unique identifier of this aggregate root. |
||
107 | * |
||
108 | * @return mixed |
||
109 | */ |
||
110 | public function getId() |
||
114 | |||
115 | /** |
||
116 | * @return mixed |
||
117 | */ |
||
118 | public function getAggregateRootId() |
||
122 | |||
123 | /** |
||
124 | * @return string |
||
125 | */ |
||
126 | public function getAggregateRootType() |
||
130 | |||
131 | /** |
||
132 | * @return Author |
||
133 | */ |
||
134 | public function getAuthor() |
||
138 | |||
139 | /** |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getEventName() |
||
146 | |||
147 | /** |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getMetadata() |
||
154 | |||
155 | /** |
||
156 | * @return DateTime |
||
157 | */ |
||
158 | public function getOccurredAt() |
||
162 | } |
||
163 |