Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Deprecate TopPage classes which are being renamed #1251

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading