Writes tests to ensure that property values are updated in docs that are of a composed type of the one that variants are being changed in.

This commit is contained in:
Shannon
2018-10-05 15:07:19 +02:00
parent 06d41086f3
commit fdc94b9d1b
8 changed files with 148 additions and 20 deletions

View File

@@ -63,5 +63,20 @@ namespace Umbraco.Core.Models
aliases = a;
return hasAnyPropertyVariationChanged;
}
/// <summary>
/// Returns the list of content types the composition is used in
/// </summary>
/// <param name="allContentTypes"></param>
/// <param name="source"></param>
/// <returns></returns>
internal static IEnumerable<IContentTypeComposition> GetWhereCompositionIsUsedInContentTypes(this IContentTypeComposition source,
IContentTypeComposition[] allContentTypes)
{
var sourceId = source != null ? source.Id : 0;
// find which content types are using this composition
return allContentTypes.Where(x => x.ContentTypeComposition.Any(y => y.Id == sourceId)).ToArray();
}
}
}

View File

@@ -10,6 +10,7 @@ namespace Umbraco.Core.Models
/// <summary>
/// Gets or sets the content types that compose this content type.
/// </summary>
//fixme: we should be storing key references, not the object else we are caching way too much
IEnumerable<IContentTypeComposition> ContentTypeComposition { get; set; }
/// <summary>