From 3830d75413d5c9a160b55c11052a076cfa12af6c Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Thu, 16 Oct 2025 08:23:20 +0200 Subject: [PATCH] Obsolete `GetAtRoot` on `DocumentCache` (#20514) Obsolete GetAtRoot on DocumentCache. --- src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs | 3 +++ .../PropertyEditors/DateTimePropertyEditorTests.cs | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs b/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs index bebb34e67c..2d3e682f94 100644 --- a/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs +++ b/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs @@ -42,6 +42,9 @@ public sealed class DocumentCache : IPublishedContentCache public IPublishedContent? GetById(Guid contentId) => GetByIdAsync(contentId).GetAwaiter().GetResult(); + [Obsolete("This method is no longer used in Umbraco and is not defined on the interface. " + + "Any usage can be replaced with a call to IDocumentNavigationQueryService.TryGetRootKeys to retrieve the document keys, " + + "with each key passed to IPublishedContentCache.GetById to retrieve the IPublishedContent instances. Scheduled for removal in Umbraco 19.")] public IEnumerable GetAtRoot(bool preview, string? culture = null) { if (_documentNavigationQueryService.TryGetRootKeys(out IEnumerable rootKeys) is false) diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/DateTimePropertyEditorTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/DateTimePropertyEditorTests.cs index 7a1a5d0dac..2e5135f1ab 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/DateTimePropertyEditorTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/DateTimePropertyEditorTests.cs @@ -8,7 +8,6 @@ using Umbraco.Cms.Core.PropertyEditors; using Umbraco.Cms.Core.PublishedCache; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Sync; -using Umbraco.Cms.Infrastructure.HybridCache; using Umbraco.Cms.Tests.Common.Builders; using Umbraco.Cms.Tests.Common.Builders.Extensions; using Umbraco.Cms.Tests.Common.Testing; @@ -127,7 +126,6 @@ public class DateTimePropertyEditorTests : UmbracoIntegrationTest Assert.IsTrue(publishResult.Success); - var test = ((DocumentCache)PublishedContentCache).GetAtRoot(false); var publishedContent = await PublishedContentCache.GetByIdAsync(createContentResult.Result.Content.Key, false); Assert.IsNotNull(publishedContent);