Skip to content

Commit

Permalink
Merge pull request silverstripe#1251 from creative-commoners/pulls/5/…
Browse files Browse the repository at this point in the history
…deprecate-top-page-classes

API Deprecate TopPage classes which are being renamed
  • Loading branch information
GuySartorelli authored Sep 9, 2024
2 parents 13f6a3f + 2410220 commit b923eae
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/TopPage/DataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SilverStripe\ORM\ValidationException;
use SilverStripe\View\ViewableData;
use SilverStripe\Forms\FieldList;
use SilverStripe\Dev\Deprecation;

/**
* Class DataExtension
Expand All @@ -23,6 +24,8 @@
* @method SiteTree TopPage()
*
* @extends BaseDataExtension<BaseElement|ElementalArea|static>
*
* @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageElementExtension
*/
class DataExtension extends BaseDataExtension
{
Expand Down Expand Up @@ -51,6 +54,17 @@ class DataExtension extends BaseDataExtension
*/
private $fixedTopPageID = 0;

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'5.4.0',
'Will be replaced with DNADesign\Elemental\Extensions\TopPageElementExtension',
Deprecation::SCOPE_CLASS
);
});
}

/**
* Extension point in @see DataObject::onAfterWrite()
*
Expand Down
14 changes: 14 additions & 0 deletions src/TopPage/FluentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\ORM\Queries\SQLUpdate;
use TractorCow\Fluent\State\FluentState;
use SilverStripe\Forms\FieldList;
use SilverStripe\Dev\Deprecation;

/**
* Class FluentExtension
Expand All @@ -19,6 +20,8 @@
* @property string $TopPageLocale
*
* @extends DataExtension<DataObject&static>
*
* @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageFluentElementExtension
*/
class FluentExtension extends DataExtension
{
Expand All @@ -29,6 +32,17 @@ class FluentExtension extends DataExtension
'TopPageLocale' => 'Varchar',
];

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'5.4.0',
'Will be replaced with DNADesign\Elemental\Extensions\TopPageFluentElementExtension',
Deprecation::SCOPE_CLASS
);
});
}

public function updateCMSFields(FieldList $fields)
{
$fields->removeByName('TopPageID');
Expand Down
14 changes: 14 additions & 0 deletions src/TopPage/SiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use SilverStripe\CMS\Model\SiteTreeExtension as BaseSiteTreeExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationException;
use SilverStripe\Dev\Deprecation;

/**
* Class SiteTreeExtension
Expand All @@ -15,6 +16,8 @@
* It can be applied directly to Page, as it only takes effect in the presence of a ElementalArea.
*
* @extends BaseSiteTreeExtension<SiteTree&ElementalPageExtension&static>
*
* @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageSiteTreeExtension
*/
class SiteTreeExtension extends BaseSiteTreeExtension
{
Expand All @@ -32,6 +35,17 @@ class SiteTreeExtension extends BaseSiteTreeExtension
*/
protected $duplicatedObjects = [];

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'5.4.0',
'Will be replaced with DNADesign\Elemental\Extensions\TopPageSiteTreeExtension',
Deprecation::SCOPE_CLASS
);
});
}

/**
* Extension point in @see DataObject::onAfterWrite()
*
Expand Down

0 comments on commit b923eae

Please sign in to comment.