metadata = $metadata; $this->webSocketSubmission = $webSocketSubmission; $this->config = $config; } public function afterSave(Entity $entity, array $options = []) { if ($options['silent'] ?? false) return; if ($entity->isNew()) return; if (!$this->config->get('useWebSocket')) return; $scope = $entity->getEntityType(); $id = $entity->id; if (!$this->metadata->get(['scopes', $scope, 'object'])) return; $data = (object) []; $topic = "recordUpdate.{$scope}.{$id}"; $this->webSocketSubmission->submit($topic, null, $data); } }