protected function storeUpdatedProjections(ProjectionMap $affected_relatives, ProjectionMap $updated_relatives) { $modified_relatives = $updated_relatives->filter(function (ProjectionInterface $projection) use($affected_relatives) { $identifier = $projection->getIdentifier(); return $projection->toArray() !== $affected_relatives->getItem($identifier)->toArray(); }); // store updates and distribute events $this->getStorageWriter()->writeMany($modified_relatives); foreach ($modified_relatives as $identifier => $modified_relative) { $update_event = new ProjectionUpdatedEvent(['uuid' => Uuid::uuid4()->toString(), 'projection_identifier' => $identifier, 'projection_type' => $modified_relative->getType()->getVariantPrefix(), 'data' => $modified_relative->toArray()]); $this->event_bus->distribute(ChannelMap::CHANNEL_INFRA, $update_event); } }