1 | <?php |
||
26 | abstract class Projector implements DomainEventSubscriberInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var QueryRepositoryInterface |
||
30 | */ |
||
31 | protected $repository; |
||
32 | |||
33 | /** |
||
34 | * Projector constructor. |
||
35 | * |
||
36 | * @param QueryRepositoryInterface $repository |
||
37 | */ |
||
38 | public function __construct(QueryRepositoryInterface $repository) |
||
42 | |||
43 | /** |
||
44 | * @param PostPersistEvent $event |
||
45 | */ |
||
46 | public function onPostPersist(PostPersistEvent $event) |
||
76 | |||
77 | /** |
||
78 | * @param Projection $projection |
||
79 | * @param array $events |
||
80 | */ |
||
81 | protected function projectEvents(Projection $projection, array $events) |
||
104 | |||
105 | /** |
||
106 | * @param ReadModelInterface $readModel |
||
107 | */ |
||
108 | protected function persist(ReadModelInterface $readModel) |
||
112 | |||
113 | /** |
||
114 | * @param ReadModelInterface $readModel |
||
115 | */ |
||
116 | protected function remove(ReadModelInterface $readModel) |
||
120 | |||
121 | /** |
||
122 | * @param IdInterface $writeModelId |
||
123 | * |
||
124 | * @return array |
||
125 | */ |
||
126 | abstract protected function readModelsFromRepository(IdInterface $writeModelId); |
||
127 | |||
128 | /** |
||
129 | * @param WriteModelInterface $writeModel |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | abstract protected function readModelsFromWriteModel(WriteModelInterface $writeModel); |
||
134 | |||
135 | /** |
||
136 | * @return string |
||
137 | */ |
||
138 | abstract protected function writeModelClass(); |
||
139 | |||
140 | /** |
||
141 | * {@inheritdoc} |
||
142 | */ |
||
143 | public static function getSubscribedEvents() |
||
149 | } |
||
150 |