1 | <?php |
||
29 | class RegistratorSubscriber implements EventSubscriberInterface |
||
30 | { |
||
31 | /** |
||
32 | * @var DocumentRegistry |
||
33 | */ |
||
34 | private $documentRegistry; |
||
35 | |||
36 | /** |
||
37 | * @param DocumentRegistry $documentRegistry |
||
38 | */ |
||
39 | public function __construct( |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | public static function getSubscribedEvents() |
||
69 | |||
70 | /** |
||
71 | * @param ConfigureOptionsEvent $event |
||
72 | */ |
||
73 | public function configureOptions(ConfigureOptionsEvent $event) |
||
80 | |||
81 | /** |
||
82 | * Set the default locale for the hydration request. |
||
83 | * |
||
84 | * @param HydrateEvent $event |
||
85 | */ |
||
86 | public function handleDefaultLocale(HydrateEvent $event) |
||
93 | |||
94 | /** |
||
95 | * If there is already a document for the node registered, use that. |
||
96 | * |
||
97 | * @param HydrateEvent $event |
||
98 | */ |
||
99 | public function handleDocumentFromRegistry(HydrateEvent $event) |
||
124 | |||
125 | /** |
||
126 | * Stop propagation if the document is already loaded in the requested locale, |
||
127 | * otherwise reset the document locale to the new locale. |
||
128 | * |
||
129 | * @param HydrateEvent $event |
||
130 | */ |
||
131 | public function handleStopPropagationAndResetLocale(HydrateEvent $event) |
||
153 | |||
154 | /** |
||
155 | * When the hydrate request has finished, mark the document has hydrated. |
||
156 | * This should be the last event listener called. |
||
157 | * |
||
158 | * @param HydrateEvent $event |
||
159 | */ |
||
160 | public function handleEndHydrate(HydrateEvent $event) |
||
164 | |||
165 | /** |
||
166 | * After the persist event has ended, unmark the document from being hydrated so that |
||
167 | * it will be re-hydrated on the next request. |
||
168 | * |
||
169 | * TODO: There might be better ways to ensure that the document state is updated. |
||
170 | * |
||
171 | * @param PersistEvent $event |
||
172 | */ |
||
173 | public function handleEndPersist(PersistEvent $event) |
||
177 | |||
178 | /** |
||
179 | * If the node for the persisted document is in the registry. |
||
180 | * |
||
181 | * @param PersistEvent|ReorderEvent $event |
||
182 | */ |
||
183 | public function handleNodeFromRegistry($event) |
||
198 | |||
199 | /** |
||
200 | * Register any document that has been created in the hydrate event. |
||
201 | * |
||
202 | * @param HydrateEvent $event |
||
203 | */ |
||
204 | public function handleHydrate(HydrateEvent $event) |
||
208 | |||
209 | /** |
||
210 | * Register any document that has been created in the persist event. |
||
211 | * |
||
212 | * @param PersistEvent $event |
||
213 | */ |
||
214 | public function handlePersist(PersistEvent $event) |
||
218 | |||
219 | /** |
||
220 | * Deregister removed documents. |
||
221 | * |
||
222 | * @param RemoveEvent $event |
||
223 | */ |
||
224 | public function handleRemove(RemoveEvent $event) |
||
229 | |||
230 | /** |
||
231 | * Clear the register on the "clear" event. |
||
232 | * |
||
233 | * @param ClearEvent $event |
||
234 | */ |
||
235 | public function handleClear(ClearEvent $event) |
||
239 | |||
240 | /** |
||
241 | * Register the document and apparently update the locale. |
||
242 | * |
||
243 | * TODO: Is locale handling already done above? |
||
244 | * |
||
245 | * @param AbstractMappingEvent $event |
||
246 | */ |
||
247 | private function handleRegister(AbstractMappingEvent $event) |
||
261 | } |
||
262 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.