From 743fe245aa7a1f06a1083e511cddf77300c758bc Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 20 Aug 2024 14:09:52 +1200 Subject: [PATCH] API Deprecate DataExtension --- src/ORM/DataExtension.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ORM/DataExtension.php b/src/ORM/DataExtension.php index 6d8a61d80..b41fa1209 100644 --- a/src/ORM/DataExtension.php +++ b/src/ORM/DataExtension.php @@ -9,15 +9,28 @@ use SilverStripe\Forms\CompositeValidator; use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\Security\Member; use Exception; +use SilverStripe\Dev\Deprecation; /** * An extension that adds additional functionality to a {@link DataObject}. * * @template T of DataObject * @extends Extension + * @deprecated 5.3.0 Subclass SilverStripe\Core\Extension\Extension instead */ abstract class DataExtension extends Extension { + public function __construct() + { + // Wrapping with Deprecation::withNoReplacement() to avoid triggering deprecation notices + // as we are unable to update existing subclasses of this class until a new major + // unless we add in the pointless empty methods that are in this class + Deprecation::withNoReplacement(function () { + $class = Extension::class; + Deprecation::notice('5.3.0', "Subclass $class instead", Deprecation::SCOPE_CLASS); + }); + parent::__construct(); + } /** * Hook for extension-specific validation.