/** * @param string $uuidPrefix * * @return AssetMapping */ private function getMappingByUuidPrefix($uuidPrefix) { $expr = Expr::startsWith($uuidPrefix, AssetMapping::UUID); $mappings = $this->assetManager->findAssetMappings($expr); if (!$mappings) { throw new RuntimeException(sprintf('The mapping with the UUID prefix "%s" does not exist.', $uuidPrefix)); } if (count($mappings) > 1) { throw new RuntimeException(sprintf('More than one mapping matches the UUID prefix "%s".', $uuidPrefix)); } return reset($mappings); }