Conditions | 5 |
Paths | 5 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public function updateIndex(GenericEvent $event): void |
||
33 | { |
||
34 | $resource = $event->getSubject(); |
||
35 | |||
36 | Assert::isInstanceOf($resource, ResourceInterface::class); |
||
37 | foreach ($this->persistersMap as $config) { |
||
38 | $method = $config[self::GET_PARENT_METHOD_KEY] ?? null; |
||
39 | |||
40 | if (null !== $method && method_exists($resource, $method)) { |
||
41 | $resource = $resource->$method(); |
||
42 | } |
||
43 | |||
44 | if ($resource instanceof $config[self::MODEL_KEY]) { |
||
45 | $this->resourceRefresher->refresh($resource, $config[self::SERVICE_ID_KEY]); |
||
46 | } |
||
50 |