public function onAfterInsert($revision, array $new, array $metadata) { if (!isset($metadata['workflow'])) { return; } if (!$revision instanceof AbstractRevision) { throw new InvalidDataException('ReferenceRecorder can only attach to AbstractRevision storage'); } $workflow = $metadata['workflow']; if ($revision instanceof PostRevision && $revision->isTopicTitle()) { list($added, $removed) = $this->calculateChangesFromTopic($workflow, $revision); } else { list($added, $removed) = $this->calculateChangesFromExisting($workflow, $revision); } $this->storage->multiPut($added); $this->storage->multiRemove($removed); // Data updates $this->linksTableUpdater->doUpdate($workflow); }