Added fix for RelateOnTrashComponent.MediaService_Trashed so relations are looked up before creating duplicates

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-10-12 15:22:11 +02:00
parent 928f42be2e
commit d0eb01b348
3 changed files with 72 additions and 34 deletions

View File

@@ -543,6 +543,18 @@ namespace Umbraco.Core.Services.Implement
}
}
/// <inheritdoc />
public IRelation GetByParentChildAndType(int parentId, int childId, IRelationType relationType)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
var query = Query<IRelation>().Where(x => x.ParentId == parentId &&
x.ChildId == childId &&
x.RelationTypeId == relationType.Id);
return _relationRepository.Get(query).FirstOrDefault();
}
}
#region Private Methods
private IRelationType GetRelationType(string relationTypeAlias)