addDependency('webSocketSubmission'); } public function afterSave(Entity $entity, array $options = []) { if (!$this->getConfig()->get('useWebSocket')) return; if (!$entity->isNew()) return; $parentId = $entity->get('parentId'); $parentType = $entity->get('parentType'); if (!$parentId) return; if (!$parentType) return; $data = (object) [ 'createdById' => $entity->get('createdById'), ]; $topic = "streamUpdate.{$parentType}.{$parentId}"; $this->getInjection('webSocketSubmission')->submit($topic, null, $data); } }