diff --git a/Service/CacheService.php b/ActionHandler/Service/CacheService.php similarity index 99% rename from Service/CacheService.php rename to ActionHandler/Service/CacheService.php index d33f1e7a..db6ec137 100644 --- a/Service/CacheService.php +++ b/ActionHandler/Service/CacheService.php @@ -171,7 +171,7 @@ private function removeDataFromCache(\MongoDB\Collection $collection, string $ty $endpoints = $collection->find()->toArray(); foreach ($endpoints as $endpoint) { if (!$this->entityManager->find($type, $endpoint['id'])) { - $this->io->writeln("removing {$endpoint['id']} from cache"); + isset($this->io) && $this->io->writeln("removing {$endpoint['id']} from cache"); $collection->findOneAndDelete(['id' => $endpoint['id']]); } } diff --git a/Service/RequestService.php b/ActionHandler/Service/RequestService.php similarity index 99% rename from Service/RequestService.php rename to ActionHandler/Service/RequestService.php index 03b4b61f..0fc5e47e 100644 --- a/Service/RequestService.php +++ b/ActionHandler/Service/RequestService.php @@ -122,11 +122,11 @@ public function getId(array $object) } elseif (isset($this->data['query']['id'])) { return $this->data['query']['id']; } elseif (isset($this->data['path']['id'])) { - return$this->data['path']['id']; + return $this->data['path']['id']; } elseif (isset($this->data['path']['{uuid}'])) { return $this->data['path']['{uuid}']; } elseif (isset($this->data['query']['uuid'])) { - return$this->data['query']['uuid']; + return $this->data['query']['uuid']; } elseif (isset($this->content['id'])) { // the id might also be passed trough the object itself return $this->content['id']; } elseif (isset($this->content['uuid'])) { @@ -544,6 +544,8 @@ public function requestHandler(array $data, array $configuration): Response if (isset($eventType) && isset($this->object)) { $event = new ActionEvent($eventType, ['response' => $this->object->toArray(), 'entity' => $this->object->getEntity()->getId()->toString()]); $this->eventDispatcher->dispatch($event, $event->getType()); + $eventData = $event->getData(); + isset($eventData['response']) && $result = $eventData['response']; } $this->handleMetadataSelf($result, $metadataSelf);