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) |
||
84 | |||
85 | /** |
||
86 | * @param Projection $projection |
||
87 | * @param array $events |
||
88 | */ |
||
89 | protected function projectEvents(Projection $projection, array $events) |
||
112 | |||
113 | /** |
||
114 | * @param ReadModelInterface $readModel |
||
115 | */ |
||
116 | protected function persist(ReadModelInterface $readModel) |
||
120 | |||
121 | /** |
||
122 | * @param ReadModelInterface $readModel |
||
123 | */ |
||
124 | protected function remove(ReadModelInterface $readModel) |
||
128 | |||
129 | /** |
||
130 | * @param IdInterface $writeModelId |
||
131 | * |
||
132 | * @return array |
||
133 | */ |
||
134 | abstract protected function readModelsFromRepository(IdInterface $writeModelId); |
||
135 | |||
136 | /** |
||
137 | * @param WriteModelInterface $writeModel |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | abstract protected function readModelsFromWriteModel(WriteModelInterface $writeModel); |
||
142 | |||
143 | /** |
||
144 | * @return string |
||
145 | */ |
||
146 | abstract protected function writeModelClass(); |
||
147 | |||
148 | /** |
||
149 | * {@inheritdoc} |
||
150 | */ |
||
151 | public static function getSubscribedEvents() |
||
157 | } |
||
158 |