1 | <?php |
||
19 | trait DomainEventDispatcherTrait |
||
20 | { |
||
21 | use EntityNamingTrait; |
||
22 | |||
23 | /** |
||
24 | * {@inheritdoc} |
||
25 | */ |
||
26 | public function handleRecursively(DomainEventInterface $event) |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function handle(DomainEventInterface $event) |
||
45 | { |
||
46 | $method = $this->getApplyMethodName($event); |
||
47 | |||
48 | if (!method_exists($this, $method)) { |
||
49 | return; |
||
50 | } |
||
51 | |||
52 | $this->{$method}($event); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Return child entities. |
||
57 | * |
||
58 | * Override this method if entity has children. |
||
59 | * |
||
60 | * @return EntityInterface[] |
||
61 | */ |
||
62 | abstract protected function getChildEntities(); |
||
63 | } |
||
64 |