Merge pull request #11347 from creative-commoners/pulls/5/deprecate-dataextension

API Deprecate DataExtension
This commit is contained in:
Guy Sartorelli 2024-08-26 09:57:25 +12:00 committed by GitHub
commit b13b657de5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,15 +9,28 @@ use SilverStripe\Forms\CompositeValidator;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use Exception; use Exception;
use SilverStripe\Dev\Deprecation;
/** /**
* An extension that adds additional functionality to a {@link DataObject}. * An extension that adds additional functionality to a {@link DataObject}.
* *
* @template T of DataObject * @template T of DataObject
* @extends Extension<T> * @extends Extension<T>
* @deprecated 5.3.0 Subclass SilverStripe\Core\Extension\Extension instead
*/ */
abstract class DataExtension extends Extension 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. * Hook for extension-specific validation.