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 28, 2024
1 parent ea93316 commit 8ffda9e
Show file tree
Hide file tree
Showing 37 changed files with 86 additions and 393 deletions.
3 changes: 0 additions & 3 deletions src/Core/Config/Middleware/ExtensionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 2 additions & 3 deletions src/Core/Extensible.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
{
Expand Down
1 change: 0 additions & 1 deletion src/Core/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/CompositeValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
* {
Expand Down
10 changes: 5 additions & 5 deletions src/ORM/Connect/TempDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
297 changes: 0 additions & 297 deletions src/ORM/DataExtension.php

This file was deleted.

Loading

0 comments on commit 8ffda9e

Please sign in to comment.