Skip to content

Commit

Permalink
API Replace Extension subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Aug 29, 2024
1 parent 33a49b8 commit d9c90f9
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/en/scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Extension/FluentChangesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChangeSetItem>
* @extends Extension<ChangeSetItem>
*/
class FluentChangesExtension extends DataExtension
class FluentChangesExtension extends Extension
{
/**
* @see ChangeSetItem::getChangeType()
Expand Down
5 changes: 2 additions & 3 deletions src/Extension/FluentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -48,9 +47,9 @@
* - data_include
*
* @template T of DataObject
* @extends DataExtension<T&static>
* @extends Extension<T&static>
*/
class FluentExtension extends DataExtension
class FluentExtension extends Extension
{
/**
* Deletions are managed via DeletePolicy
Expand Down
6 changes: 3 additions & 3 deletions src/Extension/FluentFilteredExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,9 +19,9 @@
/**
* @method ManyManyList<Locale> FilteredLocales()
*
* @extends DataExtension<DataObject&static>
* @extends Extension<DataObject&static>
*/
class FluentFilteredExtension extends DataExtension
class FluentFilteredExtension extends Extension
{
/**
* Deletions are managed via DeletePolicy
Expand Down
6 changes: 3 additions & 3 deletions src/Extension/FluentIsolatedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,9 +19,9 @@
* @property int $LocaleID
* @method Locale Locale()
*
* @extends DataExtension<DataObject&static>
* @extends Extension<DataObject&static>
*/
class FluentIsolatedExtension extends DataExtension
class FluentIsolatedExtension extends Extension
{
private static $has_one = [
'Locale' => Locale::class,
Expand Down
6 changes: 3 additions & 3 deletions src/Extension/FluentMemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -12,9 +12,9 @@
use TractorCow\Fluent\State\FluentState;

/**
* @extends DataExtension<Member>
* @extends Extension<Member>
*/
class FluentMemberExtension extends DataExtension
class FluentMemberExtension extends Extension
{
/**
* Update groups
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Extension/FluentSiteTreeExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function setUp(): void
// Clear cache
Locale::clearCached();
Domain::clearCached();
(new FluentVersionedExtension)->flushCache();
FluentVersionedExtension::reset();

FluentState::singleton()
->setLocale('de_DE')
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Extension/FluentVersionedExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function setUp(): void
// Clear cache
Locale::clearCached();
Domain::clearCached();
(new FluentVersionedExtension)->flushCache();
FluentVersionedExtension::reset();

FluentState::singleton()
->setLocale('en_NZ')
Expand Down

0 comments on commit d9c90f9

Please sign in to comment.