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