diff --git a/src/Core/Config/Middleware/ExtensionMiddleware.php b/src/Core/Config/Middleware/ExtensionMiddleware.php index f05ae866f75..e44c7fa64a4 100644 --- a/src/Core/Config/Middleware/ExtensionMiddleware.php +++ b/src/Core/Config/Middleware/ExtensionMiddleware.php @@ -10,7 +10,6 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Extension; -use SilverStripe\ORM\DataExtension; class ExtensionMiddleware implements Middleware { @@ -83,8 +82,6 @@ protected function getExtraConfig($class, $classConfig, $excludeMiddleware) // Skip base classes switch ($extensionClassParent) { case Extension::class: - case DataExtension::class: - continue 2; default: // continue } diff --git a/src/Core/Extensible.php b/src/Core/Extensible.php index ff7f7389812..e405434dc3d 100644 --- a/src/Core/Extensible.php +++ b/src/Core/Extensible.php @@ -154,7 +154,6 @@ protected function defineExtensionMethods() * Keep in mind that the extension will only be applied to new * instances, not existing ones (including all instances created through {@link singleton()}). * - * @see http://doc.silverstripe.org/framework/en/trunk/reference/dataextension * @param string $classOrExtension Class that should be extended - has to be a subclass of {@link Object} * @param string $extension Subclass of {@link Extension} with optional parameters * as a string, e.g. "Versioned" @@ -256,7 +255,7 @@ public static function remove_extension($extension) * @param string $class If omitted, will get extensions for the current class * @param bool $includeArgumentString Include the argument string in the return array, * FALSE would return array("Versioned"), TRUE returns array("Versioned('Stage','Live')"). - * @return array Numeric array of either {@link DataExtension} class names, + * @return array Numeric array of either {@link Extension} class names, * or eval'ed class name strings with constructor arguments. */ public static function get_extensions($class = null, $includeArgumentString = false) @@ -501,7 +500,7 @@ public function hasExtension($extension) * * This method also provides lazy-population of the extension_instances property. * - * @return Extension[] Map of {@link DataExtension} instances, keyed by classname. + * @return Extension[] Map of {@link Extension} instances, keyed by classname. */ public function getExtensionInstances() { diff --git a/src/Core/Extension.php b/src/Core/Extension.php index f693e21e0a4..306180727ee 100644 --- a/src/Core/Extension.php +++ b/src/Core/Extension.php @@ -7,7 +7,6 @@ /** * Add extension that can be added to an object with {@link Object::add_extension()}. - * For {@link DataObject} extensions, use {@link DataExtension}. * Each extension instance has an "owner" instance, accessible through * {@link getOwner()}. * Every object instance gets its own set of extension instances, diff --git a/src/Forms/CompositeValidator.php b/src/Forms/CompositeValidator.php index 429ddc45053..f625360488b 100644 --- a/src/Forms/CompositeValidator.php +++ b/src/Forms/CompositeValidator.php @@ -24,7 +24,7 @@ * return $compositeValidator * } * - * Or by implementing the updateCMSCompositeValidator() method in a DataExtension: + * Or by implementing the updateCMSCompositeValidator() method in an Extension: * * protected function updateCMSCompositeValidator(CompositeValidator $compositeValidator): void * { diff --git a/src/ORM/Connect/TempDatabase.php b/src/ORM/Connect/TempDatabase.php index ced43d8469d..52c87c61075 100644 --- a/src/ORM/Connect/TempDatabase.php +++ b/src/ORM/Connect/TempDatabase.php @@ -6,10 +6,10 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Environment; +use SilverStripe\Core\Extension; use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; @@ -148,9 +148,9 @@ public function kill() return; } - // Some DataExtensions keep a static cache of information that needs to + // Some Extensions keep a static cache of information that needs to // be reset whenever the database is killed - foreach (ClassInfo::subclassesFor(DataExtension::class) as $class) { + foreach (ClassInfo::subclassesFor(Extension::class) as $class) { $toCall = [$class, 'on_db_reset']; if (is_callable($toCall)) { call_user_func($toCall); @@ -171,10 +171,10 @@ public function clearAllData() $this->getConn()->clearAllData(); - // Some DataExtensions keep a static cache of information that needs to + // Some Extensions keep a static cache of information that needs to // be reset whenever the database is cleaned out $classes = array_merge( - ClassInfo::subclassesFor(DataExtension::class), + ClassInfo::subclassesFor(Extension::class), ClassInfo::subclassesFor(DataObject::class) ); foreach ($classes as $class) { diff --git a/src/ORM/DataExtension.php b/src/ORM/DataExtension.php deleted file mode 100644 index 53ffad3b71c..00000000000 --- a/src/ORM/DataExtension.php +++ /dev/null @@ -1,297 +0,0 @@ - - * @deprecated 5.3.0 Subclass SilverStripe\Core\Extension\Extension instead - */ -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. - * - * @param ValidationResult $validationResult Local validation result - * @throws ValidationException - */ - protected function updateValidate(ValidationResult $validationResult) - { - } - - /** - * Edit the given query object to support queries for this extension - * - * @param SQLSelect $query Query to augment. - * @param DataQuery $dataQuery Container DataQuery for this SQLSelect - */ - protected function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) - { - } - - /** - * Update the database schema as required by this extension. - * - * When duplicating a table's structure, remember to duplicate the create options - * as well. See {@link Versioned->augmentDatabase} for an example. - */ - protected function augmentDatabase() - { - } - - /** - * Augment a write-record request. - * - * @param array $manipulation Array of operations to augment. - */ - protected function augmentWrite(&$manipulation) - { - } - - /** - * Extend the owner's onBeforeWrite() logic - * - * See {@link DataObject::onBeforeWrite()} for context. - */ - protected function onBeforeWrite() - { - } - - /** - * Extend the owner's onAfterWrite() logic - * - * See {@link DataObject::onAfterWrite()} for context. - */ - protected function onAfterWrite() - { - } - - /** - * Extend the owner's onBeforeDelete() logic - * - * See {@link DataObject::onBeforeDelete()} for context. - */ - protected function onBeforeDelete() - { - } - - /** - * Extend the owner's onAfterDelete() logic - * - * See {@link DataObject::onAfterDelete()} for context. - */ - protected function onAfterDelete() - { - } - - /** - * Extend the owner's requireDefaultRecords() logic - * - * See {@link DataObject::requireDefaultRecords()} for context. - */ - protected function onRequireDefaultRecords() - { - } - - /** - * Extend the owner's populateDefaults() logic - * - * See {@link DataObject::populateDefaults()} for context. - */ - protected function onAfterPopulateDefaults() - { - } - - /** - * Extend the owner's onAfterBuild() logic - * - * See {@link DataObject::onAfterBuild()} for context. - */ - protected function onAfterBuild() - { - } - - /** - * Influence the owner's can() permission check value to be disallowed (false), - * allowed (true) if no other processed results are to disallow, or open (null) to not - * affect the outcome. - * - * See {@link DataObject::can()} and {@link DataObject::extendedCan()} for context. - * - * @param Member $member - * @return bool|null - */ - protected function can($member) - { - } - - /** - * Influence the owner's canEdit() permission check value to be disallowed (false), - * allowed (true) if no other processed results are to disallow, or open (null) to not - * affect the outcome. - * - * See {@link DataObject::canEdit()} and {@link DataObject::extendedCan()} for context. - * - * @param Member $member - * @return bool|null - */ - protected function canEdit($member) - { - } - - /** - * Influence the owner's canDelete() permission check value to be disallowed (false), - * allowed (true) if no other processed results are to disallow, or open (null) to not - * affect the outcome. - * - * See {@link DataObject::canDelete()} and {@link DataObject::extendedCan()} for context. - * - * @param Member $member - * @return bool|null - */ - protected function canDelete($member) - { - } - - /** - * Influence the owner's canCreate() permission check value to be disallowed (false), - * allowed (true) if no other processed results are to disallow, or open (null) to not - * affect the outcome. - * - * See {@link DataObject::canCreate()} and {@link DataObject::extendedCan()} for context. - * - * @param Member $member - * @return bool|null - */ - protected function canCreate($member) - { - } - - /** - * Define extra database fields - * - * Return a map where the keys are db, has_one, etc, and the values are - * additional fields/relations to be defined. - * - * @param string $class since this method might be called on the class directly - * @param string $extension since this can help to extract parameters to help set indexes - * @return array Returns a map where the keys are db, has_one, etc, and - * the values are additional fields/relations to be defined. - */ - public function extraStatics($class = null, $extension = null) - { - return []; - } - - /** - * This function is used to provide modifications to the form in the CMS - * by the extension. By default, no changes are made. {@link DataObject->getCMSFields()}. - * - * Please consider using {@link updateFormFields()} to globally add - * formfields to the record. The method {@link updateCMSFields()} - * should just be used to add or modify tabs, or fields which - * are specific to the CMS-context. - * - * Caution: Use {@link FieldList->addFieldToTab()} to add fields. - * - * @param FieldList $fields FieldList with a contained TabSet - */ - protected function updateCMSFields(FieldList $fields) - { - } - - /** - * This function is used to provide modifications to the Validators used on a DataObject. - * - * Caution: Use {@link CompositeValidator->addValidator()} to add Validators. - * - * @param CompositeValidator $compositeValidator - */ - protected function updateCMSCompositeValidator(CompositeValidator $compositeValidator): void - { - } - - /** - * This function is used to provide modifications to the form used - * for front end forms. {@link DataObject->getFrontEndFields()} - * - * Caution: Use {@link FieldList->push()} to add fields. - * - * @param FieldList $fields FieldList without TabSet nesting - */ - protected function updateFrontEndFields(FieldList $fields) - { - } - - /** - * This is used to provide modifications to the form actions - * used in the CMS. {@link DataObject->getCMSActions()}. - * - * @param FieldList $actions FieldList - */ - protected function updateCMSActions(FieldList $actions) - { - } - - /** - * this function is used to provide modifications to the summary fields in CMS - * by the extension - * By default, the summaryField() of its owner will merge more fields defined in the extension's - * $extra_fields['summary_fields'] - * - * @param array $fields Array of field names - */ - protected function updateSummaryFields(&$fields) - { - $summary_fields = Config::inst()->get(static::class, 'summary_fields'); - if ($summary_fields) { - // if summary_fields were passed in numeric array, - // convert to an associative array - if ($summary_fields && array_key_exists(0, $summary_fields ?? [])) { - $summary_fields = array_combine(array_values($summary_fields ?? []), array_values($summary_fields ?? [])); - } - if ($summary_fields) { - $fields = array_merge($fields, $summary_fields); - } - } - } - - /** - * this function is used to provide modifications to the fields labels in CMS - * by the extension - * By default, the fieldLabels() of its owner will merge more fields defined in the extension's - * $extra_fields['field_labels'] - * - * @param array $labels Array of field labels - */ - protected function updateFieldLabels(&$labels) - { - $field_labels = Config::inst()->get(static::class, 'field_labels'); - if ($field_labels) { - $labels = array_merge($labels, $field_labels); - } - } -} diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php index 53f14efe002..da89460b85e 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -48,7 +48,7 @@ * *

Extensions

* - * See {@link Extension} and {@link DataExtension}. + * See {@link Extension} * *

Permission Control

* @@ -1212,7 +1212,7 @@ public function forceChange() * Validate the current object. * * By default, there is no validation - objects are always valid! However, you can overload this method in your - * DataObject sub-classes to specify custom validation, or use the hook through DataExtension. + * DataObject sub-classes to specify custom validation, or use the hook through Extension. * * Invalid objects won't be able to be written - a warning will be thrown and no write will occur. onBeforeWrite() * and onAfterWrite() won't get called either. @@ -1236,8 +1236,6 @@ public function validate() * database. Don't forget to call parent::onBeforeWrite(), though! * * This called after {@link $this->validate()}, so you can be sure that your data is valid. - * - * @uses DataExtension::onBeforeWrite() */ protected function onBeforeWrite() { @@ -1252,8 +1250,6 @@ protected function onBeforeWrite() * You can overload this to act upon changes made to the data after it is written. * $this->changed will have a record * database. Don't forget to call parent::onAfterWrite(), though! - * - * @uses DataExtension::onAfterWrite() */ protected function onAfterWrite() { @@ -1282,8 +1278,6 @@ public function findCascadeDeletes($recursive = true, $list = null) * Event handler called before deleting from the database. * You can overload this to clean up or otherwise process data before delete this * record. Don't forget to call parent::onBeforeDelete(), though! - * - * @uses DataExtension::onBeforeDelete() */ protected function onBeforeDelete() { @@ -1563,8 +1557,6 @@ protected function writeManipulation($baseTable, $now, $isNewRecord) * - $this->onBeforeWrite() gets called beforehand. * - Extensions such as Versioned will amend the database-write to ensure that a version is saved. * - * @uses DataExtension::augmentWrite() - * * @param boolean $showDebug Show debugging information * @param boolean $forceInsert Run INSERT command rather than UPDATE, even if record already exists * @param boolean $forceWrite Write to database even if there are no changes @@ -1737,7 +1729,6 @@ private function skipWriteComponents($recursive, DataObject $target, array &$ski * Delete this data object. * $this->onBeforeDelete() gets called. * Note that in Versioned objects, both Stage and Live will be deleted. - * @uses DataExtension::augmentSQL() */ public function delete() { @@ -2596,7 +2587,7 @@ protected function afterUpdateCMSFields(callable $callback) * which returns a {@link FieldList} suitable for a {@link Form} object. * If not overloaded, we're using {@link scaffoldFormFields()} to automatically * generate this set. To customize, overload this method in a subclass - * or extended onto it by using {@link DataExtension->updateCMSFields()}. + * or use an Extension which implements updateCMSFields() * * * class MyCustomClass extends DataObject { @@ -2671,7 +2662,7 @@ public function getCMSCompositeValidator(): CompositeValidator * Used for simple frontend forms without relation editing * or {@link TabSet} behaviour. Uses {@link scaffoldFormFields()} * by default. To customize, either overload this method in your - * subclass, or extend it by {@link DataExtension->updateFrontEndFields()}. + * subclass, or create an Extensiona and implement updateFrontEndFields() * * @param array $params See {@link scaffoldFormFields()} * @return FieldList Always returns a simple field collection without TabSet. @@ -3685,8 +3676,6 @@ public function getSourceQueryParam($key) /** * Check the database schema and update it as necessary. - * - * @uses DataExtension::augmentDatabase() */ public function requireTable() { @@ -3767,8 +3756,6 @@ public function requireTable() * database is built, after the database tables have all been created. Overload * this to add default records when the database is built, but make sure you * call parent::requireDefaultRecords(). - * - * @uses DataExtension::requireDefaultRecords() */ public function requireDefaultRecords() { @@ -3917,7 +3904,6 @@ public function searchableFields() $fields = $rewrite; - // apply DataExtensions if present $this->extend('updateSearchableFields', $fields); return $fields; @@ -4028,6 +4014,17 @@ public function summaryFields() $rawFields = $this->config()->get('summary_fields'); // Merge associative / numeric keys + // Key could be a mixture of key types for example + // base class $summary_fields = ['Title'] - key is 0 + // extension class $summary-fields = ['Title' => 'Custom Title'] - key is 'Title' + // Sort by numeric keys first so that any associative keys will override them later + uksort($rawFields, function ($a, $b) { + if (is_int($a) && !is_int($b)) { + return -1; + } elseif (!is_int($a) && is_int($b)) { + return 1; + } + }); $fields = []; foreach ($rawFields as $key => $value) { if (is_int($key)) { @@ -4035,7 +4032,6 @@ public function summaryFields() } $fields[$key] = $value; } - if (!$fields) { $fields = []; // try to scaffold a couple of usual suspects @@ -4558,8 +4554,8 @@ protected function mergeRelatedObject($list, $added, $item) /** * Extension point to add more cache key components. - * The framework extend method will return combined values from DataExtension method(s) as an array - * The method on your DataExtension class should return a single scalar value. For example: + * The framework extend method will return combined values from Extension method(s) as an array + * The method on your Extension class should return a single scalar value. For example: * * protected function cacheKeyComponent() * { diff --git a/src/ORM/Hierarchy/Hierarchy.php b/src/ORM/Hierarchy/Hierarchy.php index ef4ab01dc11..22fd043552f 100644 --- a/src/ORM/Hierarchy/Hierarchy.php +++ b/src/ORM/Hierarchy/Hierarchy.php @@ -10,7 +10,7 @@ use SilverStripe\ORM\ValidationResult; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\DB; use SilverStripe\Versioned\Versioned; use SilverStripe\Core\Config\Config; @@ -24,9 +24,9 @@ * * @property int $ParentID * @method DataObject Parent() - * @extends DataExtension + * @extends Extension */ -class Hierarchy extends DataExtension +class Hierarchy extends Extension { /** * The lower bounds for the amount of nodes to mark. If set, the logic will expand nodes until it reaches at least diff --git a/src/ORM/Search/FulltextSearchable.php b/src/ORM/Search/FulltextSearchable.php index a4731e593a2..6c38107e936 100644 --- a/src/ORM/Search/FulltextSearchable.php +++ b/src/ORM/Search/FulltextSearchable.php @@ -7,7 +7,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\CMS\Controllers\ContentController; use SilverStripe\ORM\Connect\MySQLSchemaManager; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use Exception; /** @@ -21,9 +21,9 @@ * unless "File" is excluded from FulltextSearchable::enable(). * * @template T of SiteTree|File - * @extends DataExtension + * @extends Extension */ -class FulltextSearchable extends DataExtension +class FulltextSearchable extends Extension { /** diff --git a/src/Security/InheritedPermissionFlusher.php b/src/Security/InheritedPermissionFlusher.php index b815b8859ec..264828a72a7 100644 --- a/src/Security/InheritedPermissionFlusher.php +++ b/src/Security/InheritedPermissionFlusher.php @@ -4,14 +4,14 @@ use Psr\Log\InvalidArgumentException; use SilverStripe\Core\Flushable; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\DataObject; use SilverStripe\Core\Cache\MemberCacheFlusher; /** - * @extends DataExtension + * @extends Extension */ -class InheritedPermissionFlusher extends DataExtension implements Flushable +class InheritedPermissionFlusher extends Extension implements Flushable { /** * @var MemberCacheFlusher[] diff --git a/src/Security/InheritedPermissionsExtension.php b/src/Security/InheritedPermissionsExtension.php index e9c1975c018..065a035a303 100644 --- a/src/Security/InheritedPermissionsExtension.php +++ b/src/Security/InheritedPermissionsExtension.php @@ -2,7 +2,7 @@ namespace SilverStripe\Security; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\ManyManyList; /** @@ -15,9 +15,9 @@ * @method ManyManyList ViewerGroups() * @method ManyManyList ViewerMembers() * - * @extends DataExtension + * @extends Extension */ -class InheritedPermissionsExtension extends DataExtension +class InheritedPermissionsExtension extends Extension { private static array $db = [ 'CanViewType' => "Enum('Anyone, LoggedInUsers, OnlyTheseUsers, OnlyTheseMembers, Inherit', 'Inherit')", diff --git a/src/Security/Member.php b/src/Security/Member.php index 82b228d8ef4..1b87e2169fb 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -686,7 +686,7 @@ public function getMemberPasswordField() * Validator is used when saving a {@link CMSProfileController} or added to * any form responsible for saving a users data. * - * To customize the required fields, add a {@link DataExtension} to member + * To customize the required fields, add a {@link Extension} to member * calling the `updateValidator()` method. * * @return Member_Validator diff --git a/src/Security/Member_Validator.php b/src/Security/Member_Validator.php index af1f5448e6a..6b979847dd7 100644 --- a/src/Security/Member_Validator.php +++ b/src/Security/Member_Validator.php @@ -9,7 +9,7 @@ * Member Validator * * Custom validation for the Member object can be achieved either through an - * {@link DataExtension} on the Member_Validator object or, by specifying a subclass of + * {@link Extension} on the Member_Validator object or, by specifying a subclass of * {@link Member_Validator} through the {@link Injector} API. * The Validator can also be modified by adding an Extension to Member and implement the * updateValidator hook. diff --git a/src/Security/Security.php b/src/Security/Security.php index 214dbcb47d8..80d6fe8d4bb 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -1098,7 +1098,7 @@ public static function database_is_ready() return false; } - // HACK: DataExtensions aren't applied until a class is instantiated for + // HACK: Extensions aren't applied until a class is instantiated for // the first time, so create an instance here. singleton($class); diff --git a/tests/php/Forms/FormScaffolderTest/ArticleExtension.php b/tests/php/Forms/FormScaffolderTest/ArticleExtension.php index d8ff910d8dd..ceec24d1e30 100644 --- a/tests/php/Forms/FormScaffolderTest/ArticleExtension.php +++ b/tests/php/Forms/FormScaffolderTest/ArticleExtension.php @@ -5,9 +5,9 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class ArticleExtension extends DataExtension implements TestOnly +class ArticleExtension extends Extension implements TestOnly { private static $db = [ 'ExtendedField' => 'Varchar' diff --git a/tests/php/Forms/GridField/GridFieldTest/StadiumExtension.php b/tests/php/Forms/GridField/GridFieldTest/StadiumExtension.php index c441478c7e8..3111e25e38e 100644 --- a/tests/php/Forms/GridField/GridFieldTest/StadiumExtension.php +++ b/tests/php/Forms/GridField/GridFieldTest/StadiumExtension.php @@ -3,11 +3,11 @@ namespace SilverStripe\Forms\Tests\GridField\GridFieldTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\Filters\FulltextFilter; use SilverStripe\Forms\Tests\GridField\GridFieldTest\StadiumExtension; -class StadiumExtension extends DataExtension implements TestOnly +class StadiumExtension extends Extension implements TestOnly { protected function updateSearchableFields(&$fields) { diff --git a/tests/php/ORM/DataExtensionTest/AllMethodNames.php b/tests/php/ORM/DataExtensionTest/AllMethodNames.php index 1bd71c4e552..58a0bfce956 100644 --- a/tests/php/ORM/DataExtensionTest/AllMethodNames.php +++ b/tests/php/ORM/DataExtensionTest/AllMethodNames.php @@ -4,9 +4,9 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class AllMethodNames extends DataExtension implements TestOnly +class AllMethodNames extends Extension implements TestOnly { public function allMethodNames() { diff --git a/tests/php/ORM/DataExtensionTest/AppliedToDO.php b/tests/php/ORM/DataExtensionTest/AppliedToDO.php index 51d620cf81b..f63daf63988 100644 --- a/tests/php/ORM/DataExtensionTest/AppliedToDO.php +++ b/tests/php/ORM/DataExtensionTest/AppliedToDO.php @@ -3,9 +3,9 @@ namespace SilverStripe\ORM\Tests\DataExtensionTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class AppliedToDO extends DataExtension implements TestOnly +class AppliedToDO extends Extension implements TestOnly { public function testMethodApplied() diff --git a/tests/php/ORM/DataExtensionTest/CMSFieldsBaseExtension.php b/tests/php/ORM/DataExtensionTest/CMSFieldsBaseExtension.php index 44b3c1fae2b..60971a90dc6 100644 --- a/tests/php/ORM/DataExtensionTest/CMSFieldsBaseExtension.php +++ b/tests/php/ORM/DataExtensionTest/CMSFieldsBaseExtension.php @@ -5,12 +5,12 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; /** * Extension to top level test class, tests that updateCMSFields work */ -class CMSFieldsBaseExtension extends DataExtension implements TestOnly +class CMSFieldsBaseExtension extends Extension implements TestOnly { private static $db = [ 'ExtendedFieldKeep' => 'Varchar(255)', diff --git a/tests/php/ORM/DataExtensionTest/ContactRole.php b/tests/php/ORM/DataExtensionTest/ContactRole.php index 9122a55d41f..4ef1b49f81a 100644 --- a/tests/php/ORM/DataExtensionTest/ContactRole.php +++ b/tests/php/ORM/DataExtensionTest/ContactRole.php @@ -3,9 +3,9 @@ namespace SilverStripe\ORM\Tests\DataExtensionTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class ContactRole extends DataExtension implements TestOnly +class ContactRole extends Extension implements TestOnly { private static $db = [ 'Website' => 'Varchar', diff --git a/tests/php/ORM/DataExtensionTest/Extension1.php b/tests/php/ORM/DataExtensionTest/Extension1.php index 1b9fb62ae20..39b7340252a 100644 --- a/tests/php/ORM/DataExtensionTest/Extension1.php +++ b/tests/php/ORM/DataExtensionTest/Extension1.php @@ -3,9 +3,9 @@ namespace SilverStripe\ORM\Tests\DataExtensionTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class Extension1 extends DataExtension implements TestOnly +class Extension1 extends Extension implements TestOnly { protected function canOne($member = null) diff --git a/tests/php/ORM/DataExtensionTest/Extension2.php b/tests/php/ORM/DataExtensionTest/Extension2.php index 10f964a0f0c..34df062a907 100644 --- a/tests/php/ORM/DataExtensionTest/Extension2.php +++ b/tests/php/ORM/DataExtensionTest/Extension2.php @@ -3,9 +3,9 @@ namespace SilverStripe\ORM\Tests\DataExtensionTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class Extension2 extends DataExtension implements TestOnly +class Extension2 extends Extension implements TestOnly { protected function canOne($member = null) diff --git a/tests/php/ORM/DataExtensionTest/Faves.php b/tests/php/ORM/DataExtensionTest/Faves.php index 84fc1ab91f9..9139e657d8b 100644 --- a/tests/php/ORM/DataExtensionTest/Faves.php +++ b/tests/php/ORM/DataExtensionTest/Faves.php @@ -3,12 +3,11 @@ namespace SilverStripe\ORM\Tests\DataExtensionTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\Tests\DataExtensionTest\RelatedObject; -class Faves extends DataExtension implements TestOnly +class Faves extends Extension implements TestOnly { - private static $many_many = [ 'Faves' => RelatedObject::class ]; diff --git a/tests/php/ORM/DataExtensionTest/PlayerExtension.php b/tests/php/ORM/DataExtensionTest/PlayerExtension.php index bb5e531916a..3290a664eec 100644 --- a/tests/php/ORM/DataExtensionTest/PlayerExtension.php +++ b/tests/php/ORM/DataExtensionTest/PlayerExtension.php @@ -3,9 +3,9 @@ namespace SilverStripe\ORM\Tests\DataExtensionTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class PlayerExtension extends DataExtension implements TestOnly +class PlayerExtension extends Extension implements TestOnly { public static function get_extra_config($class = null, $extensionClass = null, $args = null) diff --git a/tests/php/ORM/DataObjectTest/Team_Extension.php b/tests/php/ORM/DataObjectTest/Team_Extension.php index 1dbb44d6251..950ce4de9af 100644 --- a/tests/php/ORM/DataObjectTest/Team_Extension.php +++ b/tests/php/ORM/DataObjectTest/Team_Extension.php @@ -3,9 +3,9 @@ namespace SilverStripe\ORM\Tests\DataObjectTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class Team_Extension extends DataExtension implements TestOnly +class Team_Extension extends Extension implements TestOnly { private static $summary_fields = [ 'Title' => 'Custom Title', // override non-associative 'Title' diff --git a/tests/php/ORM/ManyManyListTest/IndirectSecondaryExtension.php b/tests/php/ORM/ManyManyListTest/IndirectSecondaryExtension.php index b70c870eb18..74dd4132c5d 100644 --- a/tests/php/ORM/ManyManyListTest/IndirectSecondaryExtension.php +++ b/tests/php/ORM/ManyManyListTest/IndirectSecondaryExtension.php @@ -3,7 +3,7 @@ namespace SilverStripe\ORM\Tests\ManyManyListTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\ManyManyList; /** @@ -12,7 +12,7 @@ * * @method ManyManyList Primary() */ -class IndirectSecondaryExtension extends DataExtension implements TestOnly +class IndirectSecondaryExtension extends Extension implements TestOnly { private static $db = [ 'Title' => 'Varchar(255)' diff --git a/tests/php/ORM/RelatedDataServiceTest.php b/tests/php/ORM/RelatedDataServiceTest.php index 93efd4b5e6b..1b6bac844c0 100644 --- a/tests/php/ORM/RelatedDataServiceTest.php +++ b/tests/php/ORM/RelatedDataServiceTest.php @@ -106,7 +106,7 @@ public function testUsageHasOne() public function testUsageHasOneHubExtension() { - // Add DataExtension and reset database so that tables + columns get added + // Add Extension and reset database so that tables + columns get added Hub::add_extension(HubExtension::class); DataObject::reset(); RelatedDataServiceTest::resetDBSchema(true, true); @@ -212,7 +212,7 @@ public function testUsageManyManyWithoutBelongs() public function testUsageManyManyWithoutBelongsHubExtension() { - // Add DataExtension and reset database so that tables + columns get added + // Add Extension and reset database so that tables + columns get added Hub::add_extension(HubExtension::class); DataObject::reset(); RelatedDataServiceTest::resetDBSchema(true, true); diff --git a/tests/php/ORM/RelatedDataServiceTest/HubExtension.php b/tests/php/ORM/RelatedDataServiceTest/HubExtension.php index 8639cda36db..561a0787ed4 100644 --- a/tests/php/ORM/RelatedDataServiceTest/HubExtension.php +++ b/tests/php/ORM/RelatedDataServiceTest/HubExtension.php @@ -3,9 +3,9 @@ namespace SilverStripe\ORM\Tests\RelatedDataServiceTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class HubExtension extends DataExtension implements TestOnly +class HubExtension extends Extension implements TestOnly { private static $has_one = [ 'ExtHO' => Node::class diff --git a/tests/php/Security/MemberTest/AlwaysFailExtension.php b/tests/php/Security/MemberTest/AlwaysFailExtension.php index fab76a4f01e..e45d700edea 100644 --- a/tests/php/Security/MemberTest/AlwaysFailExtension.php +++ b/tests/php/Security/MemberTest/AlwaysFailExtension.php @@ -3,12 +3,12 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; /** * Extension that adds additional validation criteria */ -class AlwaysFailExtension extends DataExtension implements TestOnly +class AlwaysFailExtension extends Extension implements TestOnly { protected function updatePHP($data, $form) { diff --git a/tests/php/Security/MemberTest/EditingAllowedDeletingDeniedExtension.php b/tests/php/Security/MemberTest/EditingAllowedDeletingDeniedExtension.php index 6afd5185a04..e3c45792fb4 100644 --- a/tests/php/Security/MemberTest/EditingAllowedDeletingDeniedExtension.php +++ b/tests/php/Security/MemberTest/EditingAllowedDeletingDeniedExtension.php @@ -3,9 +3,9 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class EditingAllowedDeletingDeniedExtension extends DataExtension implements TestOnly +class EditingAllowedDeletingDeniedExtension extends Extension implements TestOnly { protected function canView($member = null) diff --git a/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php b/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php index 20542633e70..3fe1e2f3f21 100644 --- a/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php +++ b/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php @@ -3,13 +3,13 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; use SilverStripe\ORM\ValidationResult; /** * Extension that does something extra when changing a member's password */ -class ExtendedChangePasswordExtension extends DataExtension implements TestOnly +class ExtendedChangePasswordExtension extends Extension implements TestOnly { protected function onBeforeChangePassword($newPassword, $valid) { diff --git a/tests/php/Security/MemberTest/FieldsExtension.php b/tests/php/Security/MemberTest/FieldsExtension.php index 425c83f7140..d7374373c01 100644 --- a/tests/php/Security/MemberTest/FieldsExtension.php +++ b/tests/php/Security/MemberTest/FieldsExtension.php @@ -5,9 +5,9 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class FieldsExtension extends DataExtension implements TestOnly +class FieldsExtension extends Extension implements TestOnly { protected function updateCMSFields(FieldList $fields) { diff --git a/tests/php/Security/MemberTest/SurnameMustMatchFirstNameExtension.php b/tests/php/Security/MemberTest/SurnameMustMatchFirstNameExtension.php index 7f0a4a1de63..148c13c74e5 100644 --- a/tests/php/Security/MemberTest/SurnameMustMatchFirstNameExtension.php +++ b/tests/php/Security/MemberTest/SurnameMustMatchFirstNameExtension.php @@ -3,12 +3,12 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; /** * Extension that adds additional validation criteria */ -class SurnameMustMatchFirstNameExtension extends DataExtension implements TestOnly +class SurnameMustMatchFirstNameExtension extends Extension implements TestOnly { protected function updatePHP($data, $form) { diff --git a/tests/php/Security/MemberTest/ValidatorExtension.php b/tests/php/Security/MemberTest/ValidatorExtension.php index 69fb65b6011..a4f9bdca41e 100644 --- a/tests/php/Security/MemberTest/ValidatorExtension.php +++ b/tests/php/Security/MemberTest/ValidatorExtension.php @@ -3,9 +3,9 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class ValidatorExtension extends DataExtension implements TestOnly +class ValidatorExtension extends Extension implements TestOnly { protected function updateValidator($validator) diff --git a/tests/php/Security/MemberTest/ViewingAllowedExtension.php b/tests/php/Security/MemberTest/ViewingAllowedExtension.php index b71ccbfae92..1fcda675c61 100644 --- a/tests/php/Security/MemberTest/ViewingAllowedExtension.php +++ b/tests/php/Security/MemberTest/ViewingAllowedExtension.php @@ -3,9 +3,9 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class ViewingAllowedExtension extends DataExtension implements TestOnly +class ViewingAllowedExtension extends Extension implements TestOnly { protected function canView($member = null) diff --git a/tests/php/Security/MemberTest/ViewingDeniedExtension.php b/tests/php/Security/MemberTest/ViewingDeniedExtension.php index 35ef55db174..3b91cc8b5a4 100644 --- a/tests/php/Security/MemberTest/ViewingDeniedExtension.php +++ b/tests/php/Security/MemberTest/ViewingDeniedExtension.php @@ -3,9 +3,9 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\DataExtension; +use SilverStripe\Core\Extension; -class ViewingDeniedExtension extends DataExtension implements TestOnly +class ViewingDeniedExtension extends Extension implements TestOnly { protected function canView($member = null) diff --git a/tests/php/i18n/i18nTest/_fakewebroot/i18nothermodule/code/i18nTestModuleDecorator.php b/tests/php/i18n/i18nTest/_fakewebroot/i18nothermodule/code/i18nTestModuleDecorator.php index d04ab889dcc..9ac3a6f275a 100644 --- a/tests/php/i18n/i18nTest/_fakewebroot/i18nothermodule/code/i18nTestModuleDecorator.php +++ b/tests/php/i18n/i18nTest/_fakewebroot/i18nothermodule/code/i18nTestModuleDecorator.php @@ -1,8 +1,8 @@