Merge branch 'v8-fix-copy-media-types' of https://github.com/kjac/Umbraco-CMS into kjac-v8-fix-copy-media-types

This commit is contained in:
Shannon
2019-02-01 14:51:42 +11:00
7 changed files with 209 additions and 140 deletions

View File

@@ -160,5 +160,8 @@ namespace Umbraco.Core.Models
return result;
}
/// <inheritdoc />
IContentType IContentType.DeepCloneWithResetIdentities(string newAlias) => (IContentType)DeepCloneWithResetIdentities(newAlias);
}
}

View File

@@ -504,9 +504,9 @@ namespace Umbraco.Core.Models
}
}
public IContentType DeepCloneWithResetIdentities(string alias)
public ContentTypeBase DeepCloneWithResetIdentities(string alias)
{
var clone = (ContentType)DeepClone();
var clone = (ContentTypeBase)DeepClone();
clone.Alias = alias;
clone.Key = Guid.Empty;
foreach (var propertyGroup in clone.PropertyGroups)

View File

@@ -44,29 +44,7 @@ namespace Umbraco.Core.Models
/// <inheritdoc />
public override bool IsPublishing => IsPublishingConst;
/// <summary>
/// Creates a deep clone of the current entity with its identity/alias and it's property identities reset
/// </summary>
/// <returns></returns>
public new IMediaType DeepCloneWithResetIdentities(string alias)
{
var clone = (MediaType)DeepClone();
clone.Alias = alias;
clone.Key = Guid.Empty;
foreach (var propertyGroup in clone.PropertyGroups)
{
propertyGroup.ResetIdentity();
propertyGroup.ResetDirtyProperties(false);
}
foreach (var propertyType in clone.PropertyTypes)
{
propertyType.ResetIdentity();
propertyType.ResetDirtyProperties(false);
}
clone.ResetIdentity();
clone.ResetDirtyProperties(false);
return clone;
}
/// <inheritdoc />
IMediaType IMediaType.DeepCloneWithResetIdentities(string newAlias) => (IMediaType)DeepCloneWithResetIdentities(newAlias);
}
}