From d9c90f94349a3458075f47bf3536d15dd2399b5e Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 29 Aug 2024 18:26:26 +1200 Subject: [PATCH] API Replace Extension subclasses --- docs/en/scenarios.md | 4 ++-- src/Extension/FluentChangesExtension.php | 6 +++--- src/Extension/FluentExtension.php | 5 ++--- src/Extension/FluentFilteredExtension.php | 6 +++--- src/Extension/FluentIsolatedExtension.php | 6 +++--- src/Extension/FluentMemberExtension.php | 6 +++--- tests/php/Extension/FluentSiteTreeExtensionTest.php | 2 +- tests/php/Extension/FluentVersionedExtensionTest.php | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) diff --git a/docs/en/scenarios.md b/docs/en/scenarios.md index 7b0ef5d0..d1270bb9 100644 --- a/docs/en/scenarios.md +++ b/docs/en/scenarios.md @@ -109,7 +109,7 @@ If you don't want to use the Filtered Locales Extension, then we can instead add namespace MySite\Extension\SiteTree; -use SilverStripe\CMS\Model\SiteTreeExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\Queries\SQLSelect; use TractorCow\Fluent\State\FluentState; @@ -122,7 +122,7 @@ use TractorCow\Fluent\Model\Locale; * @property SiteTree|$this $owner * @mixin FluentExtension */ -class SiteTreeFluentExtension extends SiteTreeExtension +class SiteTreeFluentExtension extends Extension { /** * @param SQLSelect $query diff --git a/src/Extension/FluentChangesExtension.php b/src/Extension/FluentChangesExtension.php index 8198ff37..568089bf 100644 --- a/src/Extension/FluentChangesExtension.php +++ b/src/Extension/FluentChangesExtension.php @@ -2,15 +2,15 @@ namespace TractorCow\Fluent\Extension; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\Versioned\ChangeSetItem; /** * Adds locale-specific extensions to ChangeSet * - * @extends DataExtension + * @extends Extension */ -class FluentChangesExtension extends DataExtension +class FluentChangesExtension extends Extension { /** * @see ChangeSetItem::getChangeType() diff --git a/src/Extension/FluentExtension.php b/src/Extension/FluentExtension.php index f329d74c..a076d9ab 100644 --- a/src/Extension/FluentExtension.php +++ b/src/Extension/FluentExtension.php @@ -13,7 +13,6 @@ use SilverStripe\Forms\GridField\GridField_ActionMenuItem; use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DB; @@ -48,9 +47,9 @@ * - data_include * * @template T of DataObject - * @extends DataExtension + * @extends Extension */ -class FluentExtension extends DataExtension +class FluentExtension extends Extension { /** * Deletions are managed via DeletePolicy diff --git a/src/Extension/FluentFilteredExtension.php b/src/Extension/FluentFilteredExtension.php index 5d59a6ac..944391f1 100644 --- a/src/Extension/FluentFilteredExtension.php +++ b/src/Extension/FluentFilteredExtension.php @@ -4,7 +4,7 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\GridField\GridFieldConfig; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\ManyManyList; @@ -19,9 +19,9 @@ /** * @method ManyManyList FilteredLocales() * - * @extends DataExtension + * @extends Extension */ -class FluentFilteredExtension extends DataExtension +class FluentFilteredExtension extends Extension { /** * Deletions are managed via DeletePolicy diff --git a/src/Extension/FluentIsolatedExtension.php b/src/Extension/FluentIsolatedExtension.php index a1574c90..6348460d 100644 --- a/src/Extension/FluentIsolatedExtension.php +++ b/src/Extension/FluentIsolatedExtension.php @@ -3,7 +3,7 @@ namespace TractorCow\Fluent\Extension; use LogicException; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DB; @@ -19,9 +19,9 @@ * @property int $LocaleID * @method Locale Locale() * - * @extends DataExtension + * @extends Extension */ -class FluentIsolatedExtension extends DataExtension +class FluentIsolatedExtension extends Extension { private static $has_one = [ 'Locale' => Locale::class, diff --git a/src/Extension/FluentMemberExtension.php b/src/Extension/FluentMemberExtension.php index 45a7b283..1e7300a7 100644 --- a/src/Extension/FluentMemberExtension.php +++ b/src/Extension/FluentMemberExtension.php @@ -3,7 +3,7 @@ namespace TractorCow\Fluent\Extension; use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\Security\Group; use SilverStripe\Security\Member; use SilverStripe\Security\Member_GroupSet; @@ -12,9 +12,9 @@ use TractorCow\Fluent\State\FluentState; /** - * @extends DataExtension + * @extends Extension */ -class FluentMemberExtension extends DataExtension +class FluentMemberExtension extends Extension { /** * Update groups diff --git a/tests/php/Extension/FluentSiteTreeExtensionTest.php b/tests/php/Extension/FluentSiteTreeExtensionTest.php index b166f31f..dac0d88e 100644 --- a/tests/php/Extension/FluentSiteTreeExtensionTest.php +++ b/tests/php/Extension/FluentSiteTreeExtensionTest.php @@ -50,7 +50,7 @@ protected function setUp(): void // Clear cache Locale::clearCached(); Domain::clearCached(); - (new FluentVersionedExtension)->flushCache(); + FluentVersionedExtension::reset(); FluentState::singleton() ->setLocale('de_DE') diff --git a/tests/php/Extension/FluentVersionedExtensionTest.php b/tests/php/Extension/FluentVersionedExtensionTest.php index 44e97905..6beccc0f 100644 --- a/tests/php/Extension/FluentVersionedExtensionTest.php +++ b/tests/php/Extension/FluentVersionedExtensionTest.php @@ -29,7 +29,7 @@ protected function setUp(): void // Clear cache Locale::clearCached(); Domain::clearCached(); - (new FluentVersionedExtension)->flushCache(); + FluentVersionedExtension::reset(); FluentState::singleton() ->setLocale('en_NZ')