diff --git a/composer.json b/composer.json index 4e8fed3e73c..e064b708adb 100644 --- a/composer.json +++ b/composer.json @@ -96,6 +96,8 @@ "SilverStripe\\i18n\\Tests\\": "tests/php/i18n/", "SilverStripe\\Logging\\": "src/Logging/", "SilverStripe\\Logging\\Tests\\": "tests/php/Logging/", + "SilverStripe\\Model\\": "src/Model/", + "SilverStripe\\Model\\Tests\\": "tests/php/Model/", "SilverStripe\\ORM\\": "src/ORM/", "SilverStripe\\ORM\\Tests\\": "tests/php/ORM/", "SilverStripe\\Security\\": "src/Security/", diff --git a/src/Control/Controller.php b/src/Control/Controller.php index 299ce72a7f4..d1abe672f0b 100644 --- a/src/Control/Controller.php +++ b/src/Control/Controller.php @@ -230,7 +230,7 @@ protected function prepareResponse($response) } $this->setResponse($response); } else { - // Could be Controller, or ViewableData_Customised controller wrapper + // Could be Controller, or ModelDataCustomised controller wrapper if (ClassInfo::hasMethod($response, 'getViewer')) { if (isset($_REQUEST['debug_request'])) { $class = static::class; diff --git a/src/Control/Email/Email.php b/src/Control/Email/Email.php index 52b05dc944f..c7c350906b3 100644 --- a/src/Control/Email/Email.php +++ b/src/Control/Email/Email.php @@ -13,11 +13,11 @@ use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; use SilverStripe\View\ThemeResourceLoader; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Email as SymfonyEmail; @@ -56,9 +56,9 @@ class Email extends SymfonyEmail /** * Additional data available in a template. - * Used in the same way than {@link ViewableData->customize()}. + * Used in the same way than {@link ModelData->customize()}. */ - private ViewableData $data; + private ModelData $data; private bool $dataHasBeenSet = false; @@ -194,7 +194,7 @@ public function __construct( if ($returnPath) { $this->setReturnPath($returnPath); } - $this->data = ViewableData::create(); + $this->data = ModelData::create(); } private function getDefaultFrom(): string|array @@ -336,7 +336,7 @@ public function addAttachmentFromData(string $data, string $name, string $mime = * IsEmail: used to detect if rendering an email template rather than a page template * BaseUrl: used to get the base URL for the email */ - public function getData(): ViewableData + public function getData(): ModelData { $extraData = [ 'IsEmail' => true, @@ -357,7 +357,7 @@ public function getData(): ViewableData * * Calling setData() once means that any content set via text()/html()/setBody() will have no effect */ - public function setData(array|ViewableData $data) + public function setData(array|ModelData $data) { if (is_array($data)) { $data = ArrayData::create($data); diff --git a/src/Control/HTTPRequest.php b/src/Control/HTTPRequest.php index ee014d0fdb0..160e450d307 100644 --- a/src/Control/HTTPRequest.php +++ b/src/Control/HTTPRequest.php @@ -6,7 +6,7 @@ use BadMethodCallException; use InvalidArgumentException; use SilverStripe\Core\ClassInfo; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; /** * Represents a HTTP-request, including a URL that is tokenised for parsing, and a request method diff --git a/src/Control/RSS/RSSFeed.php b/src/Control/RSS/RSSFeed.php index c397f545457..d07819c3051 100644 --- a/src/Control/RSS/RSSFeed.php +++ b/src/Control/RSS/RSSFeed.php @@ -3,8 +3,8 @@ namespace SilverStripe\Control\RSS; use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\Core\Convert; use SilverStripe\Control\Director; @@ -12,14 +12,14 @@ use SilverStripe\Control\HTTP; use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * RSSFeed class * * This class is used to create an RSS feed. */ -class RSSFeed extends ViewableData +class RSSFeed extends ModelData { /** diff --git a/src/Control/RSS/RSSFeed_Entry.php b/src/Control/RSS/RSSFeed_Entry.php index ff6da977f43..1ebaae7e7de 100644 --- a/src/Control/RSS/RSSFeed_Entry.php +++ b/src/Control/RSS/RSSFeed_Entry.php @@ -5,7 +5,7 @@ use SilverStripe\Control\Director; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use BadMethodCallException; /** @@ -15,7 +15,7 @@ * * @see RSSFeed */ -class RSSFeed_Entry extends ViewableData +class RSSFeed_Entry extends ModelData { /** * Name of the title field of feed entries @@ -40,7 +40,7 @@ class RSSFeed_Entry extends ViewableData /** * Create a new RSSFeed entry. - * @param ViewableData $entry + * @param ModelData $entry * @param string $titleField * @param string $descriptionField * @param string $authorField diff --git a/src/Control/RequestHandler.php b/src/Control/RequestHandler.php index 4c2ee1b23df..ba1f1d9aac4 100644 --- a/src/Control/RequestHandler.php +++ b/src/Control/RequestHandler.php @@ -13,7 +13,7 @@ use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionFailureException; use SilverStripe\Security\Security; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * This class is the base class of any SilverStripe object that can be used to handle HTTP requests. @@ -45,7 +45,7 @@ * * {@link RequestHandler::handleRequest()} is where this behaviour is implemented. */ -class RequestHandler extends ViewableData +class RequestHandler extends ModelData { /** @@ -130,7 +130,7 @@ public function __construct() /** * Handles URL requests. * - * - ViewableData::handleRequest() iterates through each rule in {@link RequestHandler::$url_handlers}. + * - ModelData::handleRequest() iterates through each rule in {@link RequestHandler::$url_handlers}. * - If the rule matches, the named method will be called. * - If there is still more URL to be processed, then handleRequest() * is called on the object that that method returns. @@ -248,8 +248,8 @@ protected function findAction($request) { $handlerClass = static::class; - // We stop after RequestHandler; in other words, at ViewableData - while ($handlerClass && $handlerClass != ViewableData::class) { + // We stop after RequestHandler; in other words, at ModelData + while ($handlerClass && $handlerClass != ModelData::class) { $urlHandlers = Config::inst()->get($handlerClass, 'url_handlers', Config::UNINHERITED); if ($urlHandlers) { diff --git a/src/ORM/ArrayLib.php b/src/Core/ArrayLib.php similarity index 75% rename from src/ORM/ArrayLib.php rename to src/Core/ArrayLib.php index de2f610a64f..d50b7b7f6cc 100644 --- a/src/ORM/ArrayLib.php +++ b/src/Core/ArrayLib.php @@ -1,24 +1,15 @@ $v) { if (!in_array($key, $keys ?? [])) { unset($arr[$key]); @@ -143,14 +114,9 @@ public static function filter_keys($arr, $keys) * @param array $array * * @return boolean - * @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::is_associative() */ public static function is_associative($array) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::is_associative()'); - }); - $isAssociative = !empty($array) && is_array($array) && ($array !== array_values($array ?? [])); @@ -169,14 +135,9 @@ public static function is_associative($array) * @param boolean $strict * * @return boolean - * @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::in_array_recursive() */ public static function in_array_recursive($needle, $haystack, $strict = false) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::in_array_recursive()'); - }); - if (!is_array($haystack)) { return false; } @@ -202,14 +163,9 @@ public static function in_array_recursive($needle, $haystack, $strict = false) * @param $f callback to apply * @param $array array * @return array - * @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::array_map_recursive() */ public static function array_map_recursive($f, $array) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::array_map_recursive()'); - }); - $applyOrRecurse = function ($v) use ($f) { return is_array($v) ? ArrayLib::array_map_recursive($f, $v) : call_user_func($f, $v); }; @@ -228,14 +184,9 @@ public static function array_map_recursive($f, $array) * @param array $array * * @return array - * @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::array_merge_recursive() */ public static function array_merge_recursive($array) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::array_merge_recursive()'); - }); - $arrays = func_get_args(); $merged = []; @@ -248,7 +199,7 @@ public static function array_merge_recursive($array) if (!is_array($array)) { trigger_error( - 'SilverStripe\ORM\ArrayLib::array_merge_recursive() encountered a non array argument', + 'SilverStripe\Core\ArrayLib::array_merge_recursive() encountered a non array argument', E_USER_WARNING ); return []; @@ -278,14 +229,9 @@ public static function array_merge_recursive($array) * @param array $out * * @return array - * @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::flatten() */ public static function flatten($array, $preserveKeys = true, &$out = []) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::flatten()'); - }); - array_walk_recursive( $array, function ($value, $key) use (&$out, $preserveKeys) { @@ -310,14 +256,9 @@ function ($value, $key) use (&$out, $preserveKeys) { * * @param array $list * @return Generator - * @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::iterateVolatile() */ public static function iterateVolatile(array &$list) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::iterateVolatile()'); - }); - // Keyed by already-iterated items $iterated = []; // Get all items not yet iterated @@ -337,14 +278,9 @@ public static function iterateVolatile(array &$list) /** * Similar to shuffle, but retains the existing association between the keys and the values. * Shuffles the array in place. - * @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::shuffleAssociative() */ public static function shuffleAssociative(array &$array): void { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::shuffleAssociative()'); - }); - $shuffledArray = []; $keys = array_keys($array); shuffle($keys); diff --git a/src/Core/ClassInfo.php b/src/Core/ClassInfo.php index 46b0fa914e0..fd32d9cb545 100644 --- a/src/Core/ClassInfo.php +++ b/src/Core/ClassInfo.php @@ -9,7 +9,7 @@ use SilverStripe\Core\Manifest\ClassLoader; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Psr\SimpleCache\CacheInterface; use SilverStripe\Core\Flushable; use SilverStripe\Core\Injector\Injector; @@ -585,7 +585,7 @@ public static function classesWithExtension( // only keep classes with the Extension applied $classes = array_filter($classes ?? [], function ($class) use ($extensionClass) { - return ViewableData::has_extension($class, $extensionClass); + return ModelData::has_extension($class, $extensionClass); }); return $classes; diff --git a/src/Core/Convert.php b/src/Core/Convert.php index c7fbeed4503..4347014e85d 100644 --- a/src/Core/Convert.php +++ b/src/Core/Convert.php @@ -21,7 +21,7 @@ * html: HTML source suitable for use in a page or email * text: Plain-text content, suitable for display to a user as-is, or insertion in a plaintext email. * - * Objects of type {@link ViewableData} can have an "escaping type", + * Objects of type {@link ModelData} can have an "escaping type", * which determines if they are automatically escaped before output by {@link SSViewer}. */ class Convert diff --git a/src/Core/Extensible.php b/src/Core/Extensible.php index e405434dc3d..95782feee30 100644 --- a/src/Core/Extensible.php +++ b/src/Core/Extensible.php @@ -5,7 +5,7 @@ use InvalidArgumentException; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Allows an object to have extensions applied to it. @@ -43,7 +43,7 @@ trait Extensible * @var array */ private static $unextendable_classes = [ - ViewableData::class, + ModelData::class, ]; /** diff --git a/src/Core/Validation/ConstraintValidator.php b/src/Core/Validation/ConstraintValidator.php index 0a85fcfe3dd..9a65689986d 100644 --- a/src/Core/Validation/ConstraintValidator.php +++ b/src/Core/Validation/ConstraintValidator.php @@ -3,7 +3,7 @@ namespace SilverStripe\Core\Validation; use InvalidArgumentException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintViolationInterface; use Symfony\Component\Validator\Validation; diff --git a/src/ORM/ValidationException.php b/src/Core/Validation/ValidationException.php similarity index 86% rename from src/ORM/ValidationException.php rename to src/Core/Validation/ValidationException.php index 1ee47db2793..155da158819 100644 --- a/src/ORM/ValidationException.php +++ b/src/Core/Validation/ValidationException.php @@ -1,18 +1,15 @@ @silverstripe.com) */ -abstract class BulkLoader extends ViewableData +abstract class BulkLoader extends ModelData { private bool $checkPermissions = false; diff --git a/src/Dev/BulkLoader_Result.php b/src/Dev/BulkLoader_Result.php index be1b1251602..573a9c47a2e 100644 --- a/src/Dev/BulkLoader_Result.php +++ b/src/Dev/BulkLoader_Result.php @@ -3,9 +3,9 @@ namespace SilverStripe\Dev; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; /** * Encapsulates the result of a {@link BulkLoader} import diff --git a/src/Dev/Constraint/ViewableDataContains.php b/src/Dev/Constraint/ModelDataContains.php similarity index 85% rename from src/Dev/Constraint/ViewableDataContains.php rename to src/Dev/Constraint/ModelDataContains.php index 97bc26e50fe..fa7f839c256 100644 --- a/src/Dev/Constraint/ViewableDataContains.php +++ b/src/Dev/Constraint/ModelDataContains.php @@ -5,14 +5,14 @@ use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use SilverStripe\Dev\SapphireTest; /** - * Constraint for checking if a ViewableData (e.g. ArrayData or any DataObject) contains fields matching the given + * Constraint for checking if a ModelData (e.g. ArrayData or any DataObject) contains fields matching the given * key-value pairs. */ -class ViewableDataContains extends Constraint implements TestOnly +class ModelDataContains extends Constraint implements TestOnly { /** * @var array @@ -20,7 +20,7 @@ class ViewableDataContains extends Constraint implements TestOnly private $match; /** - * ViewableDataContains constructor. + * ModelDataContains constructor. */ public function __construct(array $match) { @@ -44,7 +44,7 @@ public function __construct(array $match) * a boolean value instead: true in case of success, false in case of a * failure. * - * @param ViewableData $other Value or object to evaluate. + * @param ModelData $other Value or object to evaluate. * @param string $description Additional information about the test * @param bool $returnResult Whether to return a result or throw an exception * diff --git a/src/Dev/Constraint/SSListContains.php b/src/Dev/Constraint/SSListContains.php index c1dd4e5927b..091293587ab 100644 --- a/src/Dev/Constraint/SSListContains.php +++ b/src/Dev/Constraint/SSListContains.php @@ -5,8 +5,8 @@ use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\ModelData; /** * Constraint for checking if a SS_List contains items matching the given @@ -72,11 +72,11 @@ public function evaluate($other, $description = '', $returnResult = false): ?boo return null; } - protected function checkIfItemEvaluatesRemainingMatches(ViewableData $item): bool + protected function checkIfItemEvaluatesRemainingMatches(ModelData $item): bool { $success = false; foreach ($this->matches as $key => $match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); if ($constraint->evaluate($item, '', true)) { $success = true; diff --git a/src/Dev/Constraint/SSListContainsOnly.php b/src/Dev/Constraint/SSListContainsOnly.php index f7fdef978f5..4221c2225e0 100644 --- a/src/Dev/Constraint/SSListContainsOnly.php +++ b/src/Dev/Constraint/SSListContainsOnly.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; /** * Constraint for checking if a SS_List contains only items matching the given diff --git a/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php b/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php index 9824cc7a85e..5c5f37d2702 100644 --- a/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php +++ b/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php @@ -5,7 +5,7 @@ use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; /** * Constraint for checking if every item in a SS_List matches a given match, @@ -19,13 +19,13 @@ class SSListContainsOnlyMatchingItems extends Constraint implements TestOnly private $match; /** - * @var ViewableDataContains + * @var ModelDataContains */ private $constraint; public function __construct($match) { - $this->constraint = new ViewableDataContains($match); + $this->constraint = new ModelDataContains($match); $this->match = $match; } diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index 3e37406d954..10025a22d63 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -33,7 +33,7 @@ use SilverStripe\ORM\Connect\TempDatabase; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\Security\Group; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\Member; diff --git a/src/Dev/TaskRunner.php b/src/Dev/TaskRunner.php index ecd87c1a26b..f37617d9c3b 100644 --- a/src/Dev/TaskRunner.php +++ b/src/Dev/TaskRunner.php @@ -11,12 +11,12 @@ use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Manifest\ModuleResourceLoader; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionProvider; use SilverStripe\Security\Security; -use SilverStripe\View\ArrayData; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ArrayData; +use SilverStripe\Model\ModelData; class TaskRunner extends Controller implements PermissionProvider { @@ -92,7 +92,7 @@ public function index() 'Info' => $renderer->renderInfo('SilverStripe Development Tools: Tasks', $baseUrl), ]; - return ViewableData::create()->renderWith(static::class, $data); + return ModelData::create()->renderWith(static::class, $data); } /** diff --git a/src/Forms/CheckboxSetField.php b/src/Forms/CheckboxSetField.php index 786d5f6e456..6f11db35799 100644 --- a/src/Forms/CheckboxSetField.php +++ b/src/Forms/CheckboxSetField.php @@ -3,10 +3,10 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\View\Requirements; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; /** * Displays a set of checkboxes as a logical group. diff --git a/src/Forms/CompositeValidator.php b/src/Forms/CompositeValidator.php index f625360488b..cc4c508c1a7 100644 --- a/src/Forms/CompositeValidator.php +++ b/src/Forms/CompositeValidator.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * CompositeValidator can contain between 0 and many different types of Validators. Each Validator is itself still diff --git a/src/Forms/DateField.php b/src/Forms/DateField.php index 880fa0827aa..5649f8039e1 100644 --- a/src/Forms/DateField.php +++ b/src/Forms/DateField.php @@ -7,7 +7,7 @@ use InvalidArgumentException; use SilverStripe\ORM\FieldType\DBDate; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Form used for editing a date string diff --git a/src/Forms/DatetimeField.php b/src/Forms/DatetimeField.php index 849a0ecb834..c822dbf7b42 100644 --- a/src/Forms/DatetimeField.php +++ b/src/Forms/DatetimeField.php @@ -7,7 +7,7 @@ use SilverStripe\i18n\i18n; use SilverStripe\ORM\FieldType\DBDate; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Form field used for editing date time strings. diff --git a/src/Forms/DropdownField.php b/src/Forms/DropdownField.php index 86a2abf25db..ed5da300034 100644 --- a/src/Forms/DropdownField.php +++ b/src/Forms/DropdownField.php @@ -2,8 +2,8 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; /** * Dropdown field, created from a select tag. diff --git a/src/Forms/FieldGroup.php b/src/Forms/FieldGroup.php index 46099ab1d1d..9a0d6c67588 100644 --- a/src/Forms/FieldGroup.php +++ b/src/Forms/FieldGroup.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Lets you include a nested group of fields inside a template. diff --git a/src/Forms/FieldList.php b/src/Forms/FieldList.php index a7898f2f23f..d0dc54ac822 100644 --- a/src/Forms/FieldList.php +++ b/src/Forms/FieldList.php @@ -6,7 +6,7 @@ use RuntimeException; use SilverStripe\Forms\Tab; use SilverStripe\Forms\TabSet; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Dev\Deprecation; /** diff --git a/src/Forms/FileUploadReceiver.php b/src/Forms/FileUploadReceiver.php index 19ed57d23ac..3aaa42ff323 100644 --- a/src/Forms/FileUploadReceiver.php +++ b/src/Forms/FileUploadReceiver.php @@ -7,13 +7,13 @@ use SilverStripe\Assets\File; use SilverStripe\Assets\Storage\AssetContainer; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\RelationList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\UnsavedRelationList; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; /** * Provides operations for reading and writing uploaded files to/from diff --git a/src/Forms/Form.php b/src/Forms/Form.php index 7719193bdaf..7ce206f8d57 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -14,12 +14,12 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\NullSecurityToken; use SilverStripe\Security\SecurityToken; use SilverStripe\View\AttributesHTML; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Base class for all forms. @@ -62,7 +62,7 @@ * For example, the "URLSegment" field in a standard CMS form would be * accessible through "admin/EditForm/field/URLSegment/FieldHolder". */ -class Form extends ViewableData implements HasRequestHandler +class Form extends ModelData implements HasRequestHandler { use AttributesHTML; use FormMessage; @@ -135,7 +135,7 @@ class Form extends ViewableData implements HasRequestHandler /** * Populated by {@link loadDataFrom()}. * - * @var ViewableData|null + * @var ModelData|null */ protected $record; @@ -1225,7 +1225,7 @@ public function sessionFieldError($message, $fieldName, $type = ValidationResult * Returns the record that has given this form its data * through {@link loadDataFrom()}. * - * @return ViewableData + * @return ModelData */ public function getRecord() { @@ -1305,7 +1305,7 @@ public function validationResult() * @uses FormField::setSubmittedValue() * @uses FormField::setValue() * - * @param array|ViewableData $data + * @param array|ModelData $data * @param int $mergeStrategy * For every field, {@link $data} is interrogated whether it contains a relevant property/key, and * what that property/key's value is. @@ -1402,7 +1402,7 @@ public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) // There's no other way to tell whether the relation actually exists $exists = false; } - // Regular ViewableData access + // Regular ModelData access } else { $exists = ( isset($data->$name) || @@ -1478,7 +1478,7 @@ public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) * Save the contents of this form into the given data object. * It will make use of setCastedField() to do this. * - * @param ViewableData&DataObjectInterface $dataObject The object to save data into + * @param ModelData&DataObjectInterface $dataObject The object to save data into * @param array|null $fieldList An optional list of fields to process. This can be useful when you have a * form that has some fields that save to one object, and some that save to another. */ diff --git a/src/Forms/FormField.php b/src/Forms/FormField.php index fe31dc6add2..0d210436b0f 100644 --- a/src/Forms/FormField.php +++ b/src/Forms/FormField.php @@ -11,10 +11,10 @@ use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\View\AttributesHTML; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a field in a form. @@ -325,7 +325,7 @@ public static function name_to_label($fieldName) * Creates a new field. * * @param string $name The internal field name, passed to forms. - * @param null|string|\SilverStripe\View\ViewableData $title The human-readable field label. + * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. * @param mixed $value The value of the field. */ public function __construct($name, $title = null, $value = null) @@ -458,7 +458,7 @@ public function Value() * * By default, makes use of $this->dataValue() * - * @param ViewableData|DataObjectInterface $record Record to save data into + * @param ModelData|DataObjectInterface $record Record to save data into */ public function saveInto(DataObjectInterface $record) { @@ -697,7 +697,7 @@ public function attrValue() * or a submitted form value they should override setSubmittedValue() instead. * * @param mixed $value Either the parent object, or array of source data being loaded - * @param array|ViewableData $data {@see Form::loadDataFrom} + * @param array|ModelData $data {@see Form::loadDataFrom} * @return $this */ public function setValue($value, $data = null) @@ -712,7 +712,7 @@ public function setValue($value, $data = null) * data formats. * * @param mixed $value - * @param array|ViewableData $data + * @param array|ModelData $data * @return $this */ public function setSubmittedValue($value, $data = null) diff --git a/src/Forms/FormMessage.php b/src/Forms/FormMessage.php index ce18ee153a6..2ac83c9fd33 100644 --- a/src/Forms/FormMessage.php +++ b/src/Forms/FormMessage.php @@ -3,13 +3,13 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\View\ViewableData; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\ModelData; /** * Form component which contains a castable message * - * @mixin ViewableData + * @mixin ModelData */ trait FormMessage { diff --git a/src/Forms/FormRequestHandler.php b/src/Forms/FormRequestHandler.php index f2426280325..d2125881116 100644 --- a/src/Forms/FormRequestHandler.php +++ b/src/Forms/FormRequestHandler.php @@ -11,9 +11,9 @@ use SilverStripe\Control\RequestHandler; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Core\Validation\ValidationException; class FormRequestHandler extends RequestHandler { diff --git a/src/Forms/Form_FieldMap.php b/src/Forms/Form_FieldMap.php index ddf03dc3492..093bbab11b2 100644 --- a/src/Forms/Form_FieldMap.php +++ b/src/Forms/Form_FieldMap.php @@ -2,9 +2,9 @@ namespace SilverStripe\Forms; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class Form_FieldMap extends ViewableData +class Form_FieldMap extends ModelData { /** diff --git a/src/Forms/GridField/GridField.php b/src/Forms/GridField/GridField.php index 495d0f5efac..12b2522c087 100644 --- a/src/Forms/GridField/GridField.php +++ b/src/Forms/GridField/GridField.php @@ -18,16 +18,16 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\GridField\FormAction\SessionStore; use SilverStripe\Forms\GridField\FormAction\StateStore; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\Filterable; -use SilverStripe\ORM\Limitable; -use SilverStripe\ORM\Sortable; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Filterable; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\Sortable; +use SilverStripe\Model\List\SS_List; use SilverStripe\View\HTML; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Displays a {@link SS_List} in a grid format. @@ -767,7 +767,7 @@ public function FieldHolder($properties = []) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * @param array $attributes * @param string $content * @@ -785,7 +785,7 @@ protected function newCell($total, $index, $record, $attributes, $content) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * @param array $attributes * @param string $content * @@ -803,7 +803,7 @@ protected function newRow($total, $index, $record, $attributes, $content) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * * @return array */ @@ -821,7 +821,7 @@ protected function getRowAttributes($total, $index, $record) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * * @return array */ @@ -892,7 +892,7 @@ public function getColumns() /** * Get the value from a column. * - * @param ViewableData $record + * @param ModelData $record * @param string $column * * @return string @@ -945,7 +945,7 @@ public function addDataFields($fields) * Use of this method ensures that any special rules around the data for this gridfield are * followed. * - * @param ViewableData $record + * @param ModelData $record * @param string $fieldName * * @return mixed @@ -972,7 +972,7 @@ public function getDataFieldValue($record, $fieldName) /** * Get extra columns attributes used as HTML attributes. * - * @param ViewableData $record + * @param ModelData $record * @param string $column * * @return array diff --git a/src/Forms/GridField/GridFieldAddExistingAutocompleter.php b/src/Forms/GridField/GridFieldAddExistingAutocompleter.php index 8db2bc62723..3c8b0aac0b3 100644 --- a/src/Forms/GridField/GridFieldAddExistingAutocompleter.php +++ b/src/Forms/GridField/GridFieldAddExistingAutocompleter.php @@ -9,11 +9,11 @@ use SilverStripe\Control\Controller; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataList; use SilverStripe\ORM\Filters\SearchFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; use LogicException; use SilverStripe\Control\HTTPResponse_Exception; diff --git a/src/Forms/GridField/GridFieldAddNewButton.php b/src/Forms/GridField/GridFieldAddNewButton.php index 67d9436574f..de4be2a8964 100644 --- a/src/Forms/GridField/GridFieldAddNewButton.php +++ b/src/Forms/GridField/GridFieldAddNewButton.php @@ -7,7 +7,7 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\RelationList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldButtonRow.php b/src/Forms/GridField/GridFieldButtonRow.php index 32855478b26..4c05eca307a 100644 --- a/src/Forms/GridField/GridFieldButtonRow.php +++ b/src/Forms/GridField/GridFieldButtonRow.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldConfig.php b/src/Forms/GridField/GridFieldConfig.php index 6851fc7a0da..e0b9bb15125 100644 --- a/src/Forms/GridField/GridFieldConfig.php +++ b/src/Forms/GridField/GridFieldConfig.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Extensible; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; /** * Encapsulates a collection of components following the diff --git a/src/Forms/GridField/GridFieldDataColumns.php b/src/Forms/GridField/GridFieldDataColumns.php index 41b0713d9c9..c12ba899f4f 100644 --- a/src/Forms/GridField/GridFieldDataColumns.php +++ b/src/Forms/GridField/GridFieldDataColumns.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Convert; use InvalidArgumentException; use LogicException; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * @see GridField @@ -155,7 +155,7 @@ public function getFieldFormatting() * HTML for the column, content of the element. * * @param GridField $gridField - * @param ViewableData $record Record displayed in this row + * @param ModelData $record Record displayed in this row * @param string $columnName * @return string HTML for the column. Return NULL to skip. */ @@ -189,7 +189,7 @@ public function getColumnContent($gridField, $record, $columnName) * Attributes for the element containing the content returned by {@link getColumnContent()}. * * @param GridField $gridField - * @param ViewableData $record displayed in this row + * @param ModelData $record displayed in this row * @param string $columnName * @return array */ @@ -225,7 +225,7 @@ public function getColumnMetadata($gridField, $column) /** * Translate a Object.RelationName.ColumnName $columnName into the value that ColumnName returns * - * @param ViewableData $record + * @param ModelData $record * @param string $columnName * @return string|null - returns null if it could not found a value */ @@ -278,7 +278,7 @@ protected function castValue($gridField, $fieldName, $value) /** * * @param GridField $gridField - * @param ViewableData $item + * @param ModelData $item * @param string $fieldName * @param string $value * @return string diff --git a/src/Forms/GridField/GridFieldDeleteAction.php b/src/Forms/GridField/GridFieldDeleteAction.php index 427cf49f2b9..dd9ca689eff 100644 --- a/src/Forms/GridField/GridFieldDeleteAction.php +++ b/src/Forms/GridField/GridFieldDeleteAction.php @@ -6,8 +6,8 @@ use SilverStripe\Control\Controller; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\ORM\ValidationException; -use SilverStripe\View\ViewableData; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Model\ModelData; /** * This class is a {@link GridField} component that adds a delete action for @@ -75,7 +75,7 @@ public function getGroup($gridField, $record, $columnName) /** * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return string|null the attribles for the action */ @@ -107,7 +107,7 @@ public function augmentColumns($gridField, &$columns) * Return any special attributes that will be used for FormField::create_tag() * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return array */ @@ -155,7 +155,7 @@ public function getActions($gridField) /** * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return string|null the HTML for the column */ @@ -183,7 +183,7 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat { $list = $gridField->getList(); if ($actionName == 'deleterecord' || $actionName == 'unlinkrelation') { - /** @var DataObjectInterface&ViewableData $item */ + /** @var DataObjectInterface&ModelData $item */ $item = $list->byID($arguments['RecordID']); if (!$item) { return; @@ -221,7 +221,7 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat /** * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return GridField_FormAction|null */ diff --git a/src/Forms/GridField/GridFieldDetailForm.php b/src/Forms/GridField/GridFieldDetailForm.php index 624276eb42e..544f6221f3c 100644 --- a/src/Forms/GridField/GridFieldDetailForm.php +++ b/src/Forms/GridField/GridFieldDetailForm.php @@ -18,7 +18,7 @@ use SilverStripe\Forms\Validator; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Provides view and edit forms at GridField-specific URLs. @@ -156,9 +156,9 @@ public function handleItem($gridField, $request) return $handler->handleRequest($request); } - protected function getRecordFromRequest(GridField $gridField, HTTPRequest $request): ?ViewableData + protected function getRecordFromRequest(GridField $gridField, HTTPRequest $request): ?ModelData { - /** @var ViewableData $record */ + /** @var ModelData $record */ if (is_numeric($request->param('ID'))) { $dataList = $gridField->getList(); $record = $dataList->byID($request->param('ID')); @@ -219,7 +219,7 @@ public function getLostRecordRedirection(GridField $gridField, HTTPRequest $requ * Build a request handler for the given record * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * @param RequestHandler $requestHandler * @return GridFieldDetailForm_ItemRequest */ diff --git a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php index ba95158dbcb..9cf1e4c0726 100644 --- a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php +++ b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php @@ -17,7 +17,7 @@ use SilverStripe\Forms\FormAction; use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\LiteralField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBHTMLText; @@ -25,13 +25,13 @@ use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\PolymorphicHasManyList; use SilverStripe\ORM\RelationList; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\ArrayData; use SilverStripe\View\HTML; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; class GridFieldDetailForm_ItemRequest extends RequestHandler { @@ -68,7 +68,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler protected $component; /** - * @var ViewableData + * @var ModelData */ protected $record; @@ -100,7 +100,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler * * @param GridField $gridField * @param GridFieldDetailForm $component - * @param ViewableData&DataObjectInterface $record + * @param ModelData&DataObjectInterface $record * @param RequestHandler $requestHandler * @param string $popupFormName */ @@ -528,7 +528,7 @@ protected function getBackLink() * Handles detection of falsey values explicitly saved into the * record by formfields * - * @param ViewableData $record + * @param ModelData $record * @param SS_List $list * @return array List of data to write to the relation */ @@ -785,7 +785,7 @@ public function httpError($errorCode, $errorMessage = null) * @param array $data * @param Form $form * @throws ValidationException On error - * @return ViewableData&DataObjectInterface Saved record + * @return ModelData&DataObjectInterface Saved record */ protected function saveFormIntoRecord($data, $form) { @@ -905,7 +905,7 @@ public function getGridField() } /** - * @return ViewableData + * @return ModelData */ public function getRecord() { diff --git a/src/Forms/GridField/GridFieldEditButton.php b/src/Forms/GridField/GridFieldEditButton.php index e3119fa6242..0654817e7d2 100644 --- a/src/Forms/GridField/GridFieldEditButton.php +++ b/src/Forms/GridField/GridFieldEditButton.php @@ -3,9 +3,9 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Control\Controller; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Provides the entry point to editing a single record presented by the @@ -91,7 +91,7 @@ public function augmentColumns($gridField, &$columns) * Return any special attributes that will be used for FormField::create_tag() * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * @param string $columnName * @return array */ @@ -139,7 +139,7 @@ public function getActions($gridField) /** * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * @param string $columnName * @return string The HTML for the column */ diff --git a/src/Forms/GridField/GridFieldExportButton.php b/src/Forms/GridField/GridFieldExportButton.php index 710b0e20757..6b543b8c49e 100644 --- a/src/Forms/GridField/GridFieldExportButton.php +++ b/src/Forms/GridField/GridFieldExportButton.php @@ -8,8 +8,8 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Core\Config\Config; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ModelData; /** * Adds an "Export list" button to the bottom of a {@link GridField}. @@ -228,7 +228,7 @@ public function generateExportFileData($gridField) ? $gridFieldColumnsComponent->getColumnsHandled($gridField) : []; - /** @var SS_List $items */ + /** @var SS_List $items */ // Remove limit as the list may be paginated, we want the full list for the export $items = $items->limit(null); diff --git a/src/Forms/GridField/GridFieldFilterHeader.php b/src/Forms/GridField/GridFieldFilterHeader.php index 2e96e28f889..9cc01d3fdb1 100755 --- a/src/Forms/GridField/GridFieldFilterHeader.php +++ b/src/Forms/GridField/GridFieldFilterHeader.php @@ -11,10 +11,10 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\Schema\FormSchema; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Search\SearchContext; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldFooter.php b/src/Forms/GridField/GridFieldFooter.php index 958e8ff705e..d1c6ace21d6 100644 --- a/src/Forms/GridField/GridFieldFooter.php +++ b/src/Forms/GridField/GridFieldFooter.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldGroupDeleteAction.php b/src/Forms/GridField/GridFieldGroupDeleteAction.php index cb7fdb19d3b..de354332334 100644 --- a/src/Forms/GridField/GridFieldGroupDeleteAction.php +++ b/src/Forms/GridField/GridFieldGroupDeleteAction.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Member; use SilverStripe\Security\Permission; use SilverStripe\Security\Security; diff --git a/src/Forms/GridField/GridFieldImportButton.php b/src/Forms/GridField/GridFieldImportButton.php index 61865a2dae0..4f0ba641ae5 100644 --- a/src/Forms/GridField/GridFieldImportButton.php +++ b/src/Forms/GridField/GridFieldImportButton.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Forms\Form; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; class GridFieldImportButton extends AbstractGridFieldComponent implements GridField_HTMLProvider diff --git a/src/Forms/GridField/GridFieldLazyLoader.php b/src/Forms/GridField/GridFieldLazyLoader.php index e117116cb76..59844114e82 100755 --- a/src/Forms/GridField/GridFieldLazyLoader.php +++ b/src/Forms/GridField/GridFieldLazyLoader.php @@ -4,9 +4,9 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\TabSet; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\Filterable; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\Filterable; +use SilverStripe\Model\List\SS_List; /** * GridFieldLazyLoader alters the {@link GridField} behavior to delay rendering of rows until the tab containing the diff --git a/src/Forms/GridField/GridFieldLevelup.php b/src/Forms/GridField/GridFieldLevelup.php index 32d22d30d61..dbadc7354a8 100644 --- a/src/Forms/GridField/GridFieldLevelup.php +++ b/src/Forms/GridField/GridFieldLevelup.php @@ -6,7 +6,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\Hierarchy\Hierarchy; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\HTML; use SilverStripe\View\SSViewer; diff --git a/src/Forms/GridField/GridFieldPaginator.php b/src/Forms/GridField/GridFieldPaginator.php index 5e2c4f01a2c..fcda7a645e3 100755 --- a/src/Forms/GridField/GridFieldPaginator.php +++ b/src/Forms/GridField/GridFieldPaginator.php @@ -3,10 +3,10 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Core\Config\Configurable; -use SilverStripe\ORM\Limitable; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\UnsavedRelationList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; use LogicException; use SilverStripe\Dev\Deprecation; diff --git a/src/Forms/GridField/GridFieldPrintButton.php b/src/Forms/GridField/GridFieldPrintButton.php index 96a47508859..bebc63d65a6 100644 --- a/src/Forms/GridField/GridFieldPrintButton.php +++ b/src/Forms/GridField/GridFieldPrintButton.php @@ -6,13 +6,13 @@ use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\Convert; use SilverStripe\Core\Extensible; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\Security\Security; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\Requirements; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Adds an "Print" button to the bottom or top of a GridField. @@ -233,7 +233,7 @@ public function generatePrintData(GridField $gridField) $gridFieldColumnsComponent = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class); - /** @var ViewableData $item */ + /** @var ModelData $item */ foreach ($items->limit(null) as $item) { // Assume item can be viewed if canView() isn't implemented if (!$item->hasMethod('canView') || $item->canView()) { diff --git a/src/Forms/GridField/GridFieldSortableHeader.php b/src/Forms/GridField/GridFieldSortableHeader.php index d0943fba374..b3705495ccc 100644 --- a/src/Forms/GridField/GridFieldSortableHeader.php +++ b/src/Forms/GridField/GridFieldSortableHeader.php @@ -4,11 +4,11 @@ use SilverStripe\Forms\LiteralField; use SilverStripe\ORM\DataObjectSchema; -use SilverStripe\ORM\Sortable; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Sortable; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; use LogicException; use SilverStripe\Core\ClassInfo; diff --git a/src/Forms/GridField/GridFieldViewButton.php b/src/Forms/GridField/GridFieldViewButton.php index a0efccd6a67..58a9ad2d4f0 100644 --- a/src/Forms/GridField/GridFieldViewButton.php +++ b/src/Forms/GridField/GridFieldViewButton.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Control\Controller; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridField_ActionMenu.php b/src/Forms/GridField/GridField_ActionMenu.php index 5e409823b7f..dc1dca75d40 100644 --- a/src/Forms/GridField/GridField_ActionMenu.php +++ b/src/Forms/GridField/GridField_ActionMenu.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridField_ActionMenuItem.php b/src/Forms/GridField/GridField_ActionMenuItem.php index d07b23b8867..2de726e96bc 100644 --- a/src/Forms/GridField/GridField_ActionMenuItem.php +++ b/src/Forms/GridField/GridField_ActionMenuItem.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * GridField action menu item interface, this provides data so the action @@ -21,7 +21,7 @@ interface GridField_ActionMenuItem extends GridFieldComponent * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return string $title */ @@ -33,7 +33,7 @@ public function getTitle($gridField, $record, $columnName); * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return array $data */ @@ -46,7 +46,7 @@ public function getExtraData($gridField, $record, $columnName); * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return string|null $group */ diff --git a/src/Forms/GridField/GridField_ActionMenuLink.php b/src/Forms/GridField/GridField_ActionMenuLink.php index 77d0fa3f0f7..6a5798cb346 100644 --- a/src/Forms/GridField/GridField_ActionMenuLink.php +++ b/src/Forms/GridField/GridField_ActionMenuLink.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Allows GridField_ActionMenuItem to act as a link @@ -15,7 +15,7 @@ interface GridField_ActionMenuLink extends GridField_ActionMenuItem * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return string $url */ diff --git a/src/Forms/GridField/GridField_ColumnProvider.php b/src/Forms/GridField/GridField_ColumnProvider.php index ee900ea400b..ab169378ea9 100644 --- a/src/Forms/GridField/GridField_ColumnProvider.php +++ b/src/Forms/GridField/GridField_ColumnProvider.php @@ -34,7 +34,7 @@ public function getColumnsHandled($gridField); * HTML for the column, content of the element. * * @param GridField $gridField - * @param ViewableData $record - Record displayed in this row + * @param ModelData $record - Record displayed in this row * @param string $columnName * @return string - HTML for the column. Return NULL to skip. */ @@ -44,7 +44,7 @@ public function getColumnContent($gridField, $record, $columnName); * Attributes for the element containing the content returned by {@link getColumnContent()}. * * @param GridField $gridField - * @param ViewableData $record displayed in this row + * @param ModelData $record displayed in this row * @param string $columnName * @return array */ diff --git a/src/Forms/GridField/GridField_DataManipulator.php b/src/Forms/GridField/GridField_DataManipulator.php index cfd00dcdf46..d0a05819f3c 100644 --- a/src/Forms/GridField/GridField_DataManipulator.php +++ b/src/Forms/GridField/GridField_DataManipulator.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; /** * Can modify the data list. diff --git a/src/Forms/GridField/GridField_SaveHandler.php b/src/Forms/GridField/GridField_SaveHandler.php index f562426156e..8e85f08b7c3 100644 --- a/src/Forms/GridField/GridField_SaveHandler.php +++ b/src/Forms/GridField/GridField_SaveHandler.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A component which is used to handle when a {@link GridField} is saved into @@ -16,7 +16,7 @@ interface GridField_SaveHandler extends GridFieldComponent * Called when a grid field is saved - i.e. the form is submitted. * * @param GridField $grid - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record */ public function handleSave(GridField $grid, DataObjectInterface $record); } diff --git a/src/Forms/GroupedDropdownField.php b/src/Forms/GroupedDropdownField.php index 59438ff45dc..2eafd217c8f 100644 --- a/src/Forms/GroupedDropdownField.php +++ b/src/Forms/GroupedDropdownField.php @@ -2,9 +2,9 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayLib; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Core\ArrayLib; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; /** * Grouped dropdown, using optgroup tags. diff --git a/src/Forms/ListboxField.php b/src/Forms/ListboxField.php index b305c453d6a..5ff18afff0c 100644 --- a/src/Forms/ListboxField.php +++ b/src/Forms/ListboxField.php @@ -2,8 +2,8 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; /** * Multi-line listbox field, created from a select tag. diff --git a/src/Forms/LiteralField.php b/src/Forms/LiteralField.php index d90b02a3c2d..0dda550c0c3 100644 --- a/src/Forms/LiteralField.php +++ b/src/Forms/LiteralField.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * This field lets you put an arbitrary piece of HTML into your forms. @@ -51,7 +51,7 @@ public function __construct($name, $content) */ public function FieldHolder($properties = []) { - if ($this->content instanceof ViewableData) { + if ($this->content instanceof ModelData) { $context = $this->content; if ($properties) { diff --git a/src/Forms/LookupField.php b/src/Forms/LookupField.php index 113ba553814..ac388fc394b 100644 --- a/src/Forms/LookupField.php +++ b/src/Forms/LookupField.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; diff --git a/src/Forms/MoneyField.php b/src/Forms/MoneyField.php index 32961addf61..1d8e4688911 100644 --- a/src/Forms/MoneyField.php +++ b/src/Forms/MoneyField.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\FieldType\DBMoney; use SilverStripe\ORM\DataObjectInterface; diff --git a/src/Forms/OptionsetField.php b/src/Forms/OptionsetField.php index f47d6dd576e..72655646c36 100644 --- a/src/Forms/OptionsetField.php +++ b/src/Forms/OptionsetField.php @@ -3,8 +3,8 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; /** * Set of radio buttons designed to emulate a dropdown. diff --git a/src/Forms/RequiredFields.php b/src/Forms/RequiredFields.php index 9412e6cfbbe..395c18a9647 100644 --- a/src/Forms/RequiredFields.php +++ b/src/Forms/RequiredFields.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; /** * Required Fields allows you to set which fields need to be present before diff --git a/src/Forms/Schema/FormSchema.php b/src/Forms/Schema/FormSchema.php index a8b712a14e7..e5cfc639a79 100644 --- a/src/Forms/Schema/FormSchema.php +++ b/src/Forms/Schema/FormSchema.php @@ -8,7 +8,7 @@ use SilverStripe\Forms\CompositeField; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use LogicException; /** diff --git a/src/Forms/SearchableDropdownTrait.php b/src/Forms/SearchableDropdownTrait.php index 83a9a0bc13e..fa751c49a2f 100644 --- a/src/Forms/SearchableDropdownTrait.php +++ b/src/Forms/SearchableDropdownTrait.php @@ -8,14 +8,14 @@ use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\Relation; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\ORM\Search\SearchContext; use SilverStripe\Security\SecurityToken; use SilverStripe\ORM\RelationList; diff --git a/src/Forms/SearchableLookupField.php b/src/Forms/SearchableLookupField.php index 85188045a61..610d2385f30 100644 --- a/src/Forms/SearchableLookupField.php +++ b/src/Forms/SearchableLookupField.php @@ -3,10 +3,10 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; /** diff --git a/src/Forms/SelectField.php b/src/Forms/SelectField.php index fb48443be9b..22485590db9 100644 --- a/src/Forms/SelectField.php +++ b/src/Forms/SelectField.php @@ -2,8 +2,8 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\Map; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\List\Map; use ArrayAccess; /** diff --git a/src/Forms/SelectionGroup.php b/src/Forms/SelectionGroup.php index 017905b2192..d814960f6bb 100644 --- a/src/Forms/SelectionGroup.php +++ b/src/Forms/SelectionGroup.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\View\HTML; diff --git a/src/Forms/SingleLookupField.php b/src/Forms/SingleLookupField.php index 9f3e8883a1f..5590574caa1 100644 --- a/src/Forms/SingleLookupField.php +++ b/src/Forms/SingleLookupField.php @@ -4,7 +4,7 @@ use SilverStripe\Core\Convert; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\ORM\Map; +use SilverStripe\Model\List\Map; use SilverStripe\ORM\FieldType\DBField; /** diff --git a/src/Forms/TreeMultiselectField.php b/src/Forms/TreeMultiselectField.php index eb4e1e02e23..a1362f24715 100644 --- a/src/Forms/TreeMultiselectField.php +++ b/src/Forms/TreeMultiselectField.php @@ -5,15 +5,15 @@ use http\Exception\InvalidArgumentException; use SilverStripe\Control\Controller; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\Relation; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\Security\Group; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * This formfield represents many-many joins using a tree selector shown in a dropdown styled element @@ -211,7 +211,7 @@ public function Field($properties = []) if ($items && count($items ?? [])) { foreach ($items as $item) { $idArray[] = $item->ID; - $titleArray[] = ($item instanceof ViewableData) + $titleArray[] = ($item instanceof ModelData) ? $item->obj($this->getLabelField())->forTemplate() : Convert::raw2xml($item->{$this->getLabelField()}); } diff --git a/src/Forms/Validator.php b/src/Forms/Validator.php index 60594e011d4..786931ea87c 100644 --- a/src/Forms/Validator.php +++ b/src/Forms/Validator.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Extensible; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * This validation class handles all form and custom form validation through the use of Required diff --git a/src/View/ArrayData.php b/src/Model/ArrayData.php similarity index 83% rename from src/View/ArrayData.php rename to src/Model/ArrayData.php index f94fb220244..185eebf7b79 100644 --- a/src/View/ArrayData.php +++ b/src/Model/ArrayData.php @@ -1,14 +1,13 @@ * new ArrayData(array( @@ -16,10 +15,8 @@ * "AddAction" => "Add a new Page page", * )); * - * - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\ArrayData */ -class ArrayData extends ViewableData +class ArrayData extends ModelData { /** @@ -34,10 +31,6 @@ class ArrayData extends ViewableData */ public function __construct($value = []) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\ArrayData', Deprecation::SCOPE_CLASS); - }); - if (is_object($value)) { $this->array = get_object_vars($value); } elseif (is_array($value)) { @@ -72,7 +65,7 @@ public function toMap() * * * If the value is an object but not an instance of - * ViewableData, it will be converted recursively to an + * ModelData, it will be converted recursively to an * ArrayData. * * If the value is an associative array, it will likewise be @@ -81,7 +74,7 @@ public function toMap() public function getField(string $fieldName): mixed { $value = $this->array[$fieldName]; - if (is_object($value) && !($value instanceof ViewableData) && !is_iterable($value)) { + if (is_object($value) && !($value instanceof ModelData) && !is_iterable($value)) { return new ArrayData($value); } elseif (ArrayLib::is_associative($value)) { return new ArrayData($value); diff --git a/src/ORM/ArrayList.php b/src/Model/List/ArrayList.php similarity index 97% rename from src/ORM/ArrayList.php rename to src/Model/List/ArrayList.php index 3e1df3d37e1..2f527387f76 100644 --- a/src/ORM/ArrayList.php +++ b/src/Model/List/ArrayList.php @@ -1,19 +1,15 @@ * @implements Sortable * @implements Limitable - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\ArrayList */ -class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, Limitable +class ArrayList extends ModelData implements SS_List, Filterable, Sortable, Limitable { use SearchFilterable; @@ -61,10 +56,6 @@ class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, L */ public function __construct(array $items = []) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\List\ArrayList', Deprecation::SCOPE_CLASS); - }); - $this->items = array_values($items ?? []); parent::__construct(); } @@ -584,7 +575,7 @@ public function canFilterBy($by) return array_key_exists($by, $firstRecord); } - if ($firstRecord instanceof ViewableData) { + if ($firstRecord instanceof ModelData) { return $firstRecord->hasField($by); } diff --git a/src/ORM/Filterable.php b/src/Model/List/Filterable.php similarity index 97% rename from src/ORM/Filterable.php rename to src/Model/List/Filterable.php index 4caf7032fc7..3ede8179faa 100644 --- a/src/ORM/Filterable.php +++ b/src/Model/List/Filterable.php @@ -1,6 +1,6 @@ - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\Filterable */ interface Filterable extends SS_List { diff --git a/src/ORM/GroupedList.php b/src/Model/List/GroupedList.php similarity index 76% rename from src/ORM/GroupedList.php rename to src/Model/List/GroupedList.php index e81d5bbbede..a9db77e8c61 100644 --- a/src/ORM/GroupedList.php +++ b/src/Model/List/GroupedList.php @@ -1,9 +1,8 @@ - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\GroupedList */ class GroupedList extends ListDecorator { - - public function __construct(SS_List&Sortable&Filterable&Limitable $list) - { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\List\GroupedList', Deprecation::SCOPE_CLASS); - }); - parent::__construct($list); - } - /** * @param string $index * @return array diff --git a/src/ORM/Limitable.php b/src/Model/List/Limitable.php similarity index 90% rename from src/ORM/Limitable.php rename to src/Model/List/Limitable.php index f9e29064943..27a2fe8bee7 100644 --- a/src/ORM/Limitable.php +++ b/src/Model/List/Limitable.php @@ -1,6 +1,6 @@ - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\Limitable */ interface Limitable extends SS_List { diff --git a/src/ORM/ListDecorator.php b/src/Model/List/ListDecorator.php similarity index 94% rename from src/ORM/ListDecorator.php rename to src/Model/List/ListDecorator.php index ffcaf4c98c5..6cfc963b425 100644 --- a/src/ORM/ListDecorator.php +++ b/src/Model/List/ListDecorator.php @@ -1,10 +1,9 @@ * @implements Filterable * @implements Limitable - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\ListDecorator */ -abstract class ListDecorator extends ViewableData implements SS_List, Sortable, Filterable, Limitable +abstract class ListDecorator extends ModelData implements SS_List, Sortable, Filterable, Limitable { /** * @var TList @@ -32,12 +30,7 @@ abstract class ListDecorator extends ViewableData implements SS_List, Sortable, */ public function __construct(SS_List&Sortable&Filterable&Limitable $list) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\List\ListDecorator', Deprecation::SCOPE_CLASS); - }); - $this->setList($list); - parent::__construct(); } diff --git a/src/ORM/Map.php b/src/Model/List/Map.php similarity index 95% rename from src/ORM/Map.php rename to src/Model/List/Map.php index 186cf2246fd..e523b8c46d3 100644 --- a/src/ORM/Map.php +++ b/src/Model/List/Map.php @@ -1,18 +1,15 @@ list = $list; $this->keyField = $keyField; $this->valueField = $valueField; diff --git a/src/ORM/PaginatedList.php b/src/Model/List/PaginatedList.php similarity index 97% rename from src/ORM/PaginatedList.php rename to src/Model/List/PaginatedList.php index b7d392700f4..3df3dfbc024 100644 --- a/src/ORM/PaginatedList.php +++ b/src/Model/List/PaginatedList.php @@ -1,15 +1,14 @@ - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\PaginatedList */ class PaginatedList extends ListDecorator { @@ -41,10 +39,6 @@ class PaginatedList extends ListDecorator */ public function __construct(SS_List $list, $request = []) { - Deprecation::withNoReplacement(function () { - Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\List\PaginatedList', Deprecation::SCOPE_CLASS); - }); - if (!is_array($request) && !$request instanceof ArrayAccess) { throw new Exception('The request must be readable as an array.'); } diff --git a/src/ORM/SS_List.php b/src/Model/List/SS_List.php similarity index 95% rename from src/ORM/SS_List.php rename to src/Model/List/SS_List.php index 4cb769a86ba..3b788193f5d 100644 --- a/src/ORM/SS_List.php +++ b/src/Model/List/SS_List.php @@ -1,6 +1,6 @@ * @extends IteratorAggregate - * - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\SS_List */ interface SS_List extends ArrayAccess, Countable, IteratorAggregate { diff --git a/src/ORM/Sortable.php b/src/Model/List/Sortable.php similarity index 92% rename from src/ORM/Sortable.php rename to src/Model/List/Sortable.php index 2fd84c9111c..c818cc5644e 100644 --- a/src/ORM/Sortable.php +++ b/src/Model/List/Sortable.php @@ -1,6 +1,6 @@ - * @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\Sortable */ interface Sortable extends SS_List { diff --git a/src/View/ViewableData.php b/src/Model/ModelData.php similarity index 86% rename from src/View/ViewableData.php rename to src/Model/ModelData.php index a13ab5702c0..04d5a1fc027 100644 --- a/src/View/ViewableData.php +++ b/src/Model/ModelData.php @@ -1,6 +1,6 @@ failover) { @@ -162,7 +158,7 @@ public function setFailover(ViewableData $failover): void /** * Get the current failover object if set */ - public function getFailover(): ?ViewableData + public function getFailover(): ?ModelData { return $this->failover; } @@ -192,7 +188,7 @@ public function getField(string $fieldName): mixed public function setField(string $fieldName, mixed $value): static { $this->objCacheClear(); - // prior to PHP 8.2 support ViewableData::setField() simply used `$this->field = $value;` + // prior to PHP 8.2 support ModelData::setField() simply used `$this->field = $value;` // so the following logic essentially mimics this behaviour, though without the use // of now deprecated dynamic properties if ($this->isAccessibleProperty($fieldName)) { @@ -219,7 +215,7 @@ public function hasDynamicData(string $field): bool /** * Returns true if a method exists for the current class which isn't private. - * Also returns true for private methods if $this is ViewableData (not a subclass) + * Also returns true for private methods if $this is ModelData (not a subclass) */ private function isAccessibleMethod(string $method): bool { @@ -227,25 +223,25 @@ private function isAccessibleMethod(string $method): bool // Methods added via extensions are accessible return $this->hasCustomMethod($method); } - // All methods defined on ViewableData are accessible to ViewableData - if (static::class === ViewableData::class) { + // All methods defined on ModelData are accessible to ModelData + if (static::class === ModelData::class) { return true; } - // Private methods defined on subclasses are not accessible to ViewableData + // Private methods defined on subclasses are not accessible to ModelData $reflectionMethod = new ReflectionMethod($this, $method); return !$reflectionMethod->isPrivate(); } /** * Returns true if a property exists for the current class which isn't private. - * Also returns true for private properties if $this is ViewableData (not a subclass) + * Also returns true for private properties if $this is ModelData (not a subclass) */ private function isAccessibleProperty(string $property): bool { if (!property_exists($this, $property)) { return false; } - if (static::class === ViewableData::class) { + if (static::class === ModelData::class) { return true; } $reflectionProperty = new ReflectionProperty($this, $property); @@ -255,15 +251,15 @@ private function isAccessibleProperty(string $property): bool // ----------------------------------------------------------------------------------------------------------------- /** - * Add methods from the {@link ViewableData::$failover} object, as well as wrapping any methods prefixed with an - * underscore into a {@link ViewableData::cachedCall()}. + * Add methods from the {@link ModelData::$failover} object, as well as wrapping any methods prefixed with an + * underscore into a {@link ModelData::cachedCall()}. * * @throws LogicException */ public function defineMethods() { if ($this->failover && !is_object($this->failover)) { - throw new LogicException("ViewableData::\$failover set to a non-object"); + throw new LogicException("ModelData::\$failover set to a non-object"); } if ($this->failover) { $this->addMethodsFrom('failover'); @@ -278,23 +274,23 @@ public function defineMethods() } /** - * Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance + * Merge some arbitrary data in with this object. This method returns a {@link ModelDataCustomised} instance * with references to both this and the new custom data. * * Note that any fields you specify will take precedence over the fields on this object. */ - public function customise(array|ViewableData $data): ViewableData + public function customise(array|ModelData $data): ModelData { if (is_array($data) && (empty($data) || ArrayLib::is_associative($data))) { $data = new ArrayData($data); } - if ($data instanceof ViewableData) { - return new ViewableData_Customised($this, $data); + if ($data instanceof ModelData) { + return new ModelDataCustomised($this, $data); } throw new InvalidArgumentException( - 'ViewableData->customise(): $data must be an associative array or a ViewableData instance' + 'ModelData->customise(): $data must be an associative array or a ModelData instance' ); } @@ -317,12 +313,12 @@ public function __toString(): string return static::class; } - public function getCustomisedObj(): ?ViewableData + public function getCustomisedObj(): ?ModelData { return $this->customisedObject; } - public function setCustomisedObj(ViewableData $object) + public function setCustomisedObj(ModelData $object) { $this->customisedObject = $object; } @@ -421,9 +417,9 @@ public function escapeTypeForField(string $field): string * - an SSViewer instance * * @param string|array|SSViewer $template the template to render into - * @param ViewableData|array|null $customFields fields to customise() the object with before rendering + * @param ModelData|array|null $customFields fields to customise() the object with before rendering */ - public function renderWith($template, ViewableData|array|null $customFields = null): DBHTMLText + public function renderWith($template, ModelData|array|null $customFields = null): DBHTMLText { if (!is_object($template)) { $template = SSViewer::create($template); @@ -431,7 +427,7 @@ public function renderWith($template, ViewableData|array|null $customFields = nu $data = $this->getCustomisedObj() ?: $this; - if ($customFields instanceof ViewableData) { + if ($customFields instanceof ModelData) { $data = $data->customise($customFields); } if ($template instanceof SSViewer) { @@ -439,7 +435,7 @@ public function renderWith($template, ViewableData|array|null $customFields = nu } throw new UnexpectedValueException( - "ViewableData::renderWith(): unexpected " . get_class($template) . " object, expected an SSViewer instance" + "ModelData::renderWith(): unexpected " . get_class($template) . " object, expected an SSViewer instance" ); } @@ -546,7 +542,7 @@ public function obj( } } - // Wrap list arrays in ViewableData so templates can handle them + // Wrap list arrays in ModelData so templates can handle them if (is_array($value) && array_is_list($value)) { $value = ArrayList::create($value); } @@ -569,7 +565,7 @@ public function obj( } /** - * A simple wrapper around {@link ViewableData::obj()} that automatically caches the result so it can be used again + * A simple wrapper around {@link ModelData::obj()} that automatically caches the result so it can be used again * without re-running the method. * * @return Object|DBField @@ -586,7 +582,7 @@ public function cachedCall(string $fieldName, array $arguments = [], ?string $ca public function hasValue(string $field, array $arguments = [], bool $cache = true): bool { $result = $this->obj($field, $arguments, $cache); - if ($result instanceof ViewableData) { + if ($result instanceof ModelData) { return $result->exists(); } return (bool) $result; @@ -629,7 +625,7 @@ public function getXMLValues(array $fields): array */ public function getViewerTemplates(string $suffix = ''): array { - return SSViewer::get_templates_by_class(static::class, $suffix, ViewableData::class); + return SSViewer::get_templates_by_class(static::class, $suffix, ModelData::class); } /** @@ -645,12 +641,12 @@ public function Me(): static * Get part of the current classes ancestry to be used as a CSS class. * * This method returns an escaped string of CSS classes representing the current classes ancestry until it hits a - * stop point - e.g. "Page DataObject ViewableData". + * stop point - e.g. "Page DataObject ModelData". * - * @param string $stopAtClass the class to stop at (default: ViewableData) + * @param string $stopAtClass the class to stop at (default: ModelData) * @uses ClassInfo */ - public function CSSClasses(string $stopAtClass = ViewableData::class): string + public function CSSClasses(string $stopAtClass = ModelData::class): string { $classes = []; $classAncestry = array_reverse(ClassInfo::ancestry(static::class) ?? []); @@ -677,8 +673,8 @@ public function CSSClasses(string $stopAtClass = ViewableData::class): string /** * Return debug information about this object that can be rendered into a template */ - public function Debug(): ViewableData|string + public function Debug(): ModelData|string { - return ViewableData_Debugger::create($this); + return ModelDataDebugger::create($this); } } diff --git a/src/View/ViewableData_Customised.php b/src/Model/ModelDataCustomised.php similarity index 77% rename from src/View/ViewableData_Customised.php rename to src/Model/ModelDataCustomised.php index d2a9b1b6dcc..6ae73be21ac 100644 --- a/src/View/ViewableData_Customised.php +++ b/src/Model/ModelDataCustomised.php @@ -1,27 +1,18 @@ original = $originalObject; $this->customised = $customisedObject; diff --git a/src/View/ViewableData_Debugger.php b/src/Model/ModelDataDebugger.php similarity index 77% rename from src/View/ViewableData_Debugger.php rename to src/Model/ModelDataDebugger.php index 171088f8e3e..8eeacffe834 100644 --- a/src/View/ViewableData_Debugger.php +++ b/src/Model/ModelDataDebugger.php @@ -1,23 +1,18 @@ object = $object; parent::__construct(); } @@ -77,7 +72,7 @@ public function forTemplate(?string $field = null): string // check for an extra attached data if ($this->object->hasMethod('data') && $this->object->data() != $this->object) { - $debug .= ViewableData_Debugger::create($this->object->data())->forTemplate(); + $debug .= ModelDataDebugger::create($this->object->data())->forTemplate(); } return $debug; diff --git a/src/ORM/Connect/DBQueryBuilder.php b/src/ORM/Connect/DBQueryBuilder.php index f2f16d03413..210b0130198 100644 --- a/src/ORM/Connect/DBQueryBuilder.php +++ b/src/ORM/Connect/DBQueryBuilder.php @@ -12,8 +12,8 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DB; -use SilverStripe\ORM\ListDecorator; -use SilverStripe\ORM\Map; +use SilverStripe\Model\List\ListDecorator; +use SilverStripe\Model\List\Map; use SilverStripe\ORM\Queries\SQLExpression; use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLDelete; diff --git a/src/ORM/Connect/Database.php b/src/ORM/Connect/Database.php index 525ff3fdbed..871e8d120ab 100644 --- a/src/ORM/Connect/Database.php +++ b/src/ORM/Connect/Database.php @@ -6,7 +6,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\Dev\Debug; use SilverStripe\ORM\DB; -use SilverStripe\ORM\PaginatedList; +use SilverStripe\Model\List\PaginatedList; use SilverStripe\ORM\Queries\SQLUpdate; use SilverStripe\ORM\Queries\SQLInsert; use BadMethodCallException; diff --git a/src/ORM/Connect/MySQLDatabase.php b/src/ORM/Connect/MySQLDatabase.php index 0935300f22a..0308ae4ffb6 100644 --- a/src/ORM/Connect/MySQLDatabase.php +++ b/src/ORM/Connect/MySQLDatabase.php @@ -6,9 +6,9 @@ use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Convert; -use SilverStripe\ORM\PaginatedList; +use SilverStripe\Model\List\PaginatedList; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\Queries\SQLSelect; use Exception; diff --git a/src/ORM/DataList.php b/src/ORM/DataList.php index 23c89029de4..d703d3b9050 100644 --- a/src/ORM/DataList.php +++ b/src/ORM/DataList.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\Debug; use SilverStripe\ORM\Queries\SQLConditionGroup; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Exception; use InvalidArgumentException; use LogicException; @@ -13,7 +13,12 @@ use SilverStripe\ORM\Connect\Query; use Traversable; use SilverStripe\ORM\DataQuery; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\Filterable; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\Map; +use SilverStripe\Model\List\Sortable; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\Filters\SearchFilterable; /** @@ -42,7 +47,7 @@ * @implements Sortable * @implements Limitable */ -class DataList extends ViewableData implements SS_List, Filterable, Sortable, Limitable +class DataList extends ModelData implements SS_List, Filterable, Sortable, Limitable { use SearchFilterable; @@ -924,7 +929,7 @@ public function createDataObject($row) private function setDataObjectEagerLoadedData(DataObject $item): void { - // cache $item->ID at the top of this method to reduce calls to ViewableData::__get() + // cache $item->ID at the top of this method to reduce calls to ModelData::__get() $itemID = $item->ID; foreach (array_keys($this->eagerLoadedData) as $relation) { if (array_key_exists($itemID, $this->eagerLoadedData[$relation])) { diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php index da89460b85e..178db68e59d 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -11,6 +11,8 @@ use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Resettable; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Dev\Debug; use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\FieldList; @@ -24,6 +26,8 @@ use SilverStripe\Forms\SearchableDropdownField; use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18nEntityProvider; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\Connect\MySQLSchemaManager; use SilverStripe\ORM\FieldType\DBComposite; use SilverStripe\ORM\FieldType\DBDatetime; @@ -40,7 +44,7 @@ use SilverStripe\Security\Permission; use SilverStripe\Security\Security; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use stdClass; /** @@ -111,7 +115,7 @@ * @property string $Created Date and time of DataObject creation. * @property string $ObsoleteClassName If ClassName no longer exists this will be set to the legacy value */ -class DataObject extends ViewableData implements DataObjectInterface, i18nEntityProvider, Resettable +class DataObject extends ModelData implements DataObjectInterface, i18nEntityProvider, Resettable { /** * Human-readable singular name. @@ -3280,7 +3284,7 @@ public function dbObject($fieldName) * can throw a LogicException. * * @param string $fieldPath List of paths on this object. All items in this path - * must be ViewableData implementors + * must be ModelData implementors * * @return mixed DBField of the field on the object or a DataList instance. * @throws LogicException If accessing invalid relations @@ -3305,7 +3309,7 @@ public function relObject($fieldPath) $component = $singleton->dbObject($relation) ?: $component->relation($relation); } elseif ($component instanceof DataObject && ($dbObject = $component->dbObject($relation))) { $component = $dbObject; - } elseif ($component instanceof ViewableData && $component->hasField($relation)) { + } elseif ($component instanceof ModelData && $component->hasField($relation)) { $component = $component->obj($relation); } else { throw new LogicException( @@ -3944,7 +3948,7 @@ public function fieldLabels($includerelations = true) $ancestry = array_reverse($ancestry ?? []); if ($ancestry) { foreach ($ancestry as $ancestorClass) { - if ($ancestorClass === ViewableData::class) { + if ($ancestorClass === ModelData::class) { break; } $types = [ diff --git a/src/ORM/DataObjectSchema.php b/src/ORM/DataObjectSchema.php index 9fc2ca6646e..daeea0f6553 100644 --- a/src/ORM/DataObjectSchema.php +++ b/src/ORM/DataObjectSchema.php @@ -5,6 +5,7 @@ use Exception; use InvalidArgumentException; use LogicException; +use SilverStripe\Core\ArrayLib; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Configurable; diff --git a/src/ORM/EagerLoadedList.php b/src/ORM/EagerLoadedList.php index e006698007c..d65a49d3767 100644 --- a/src/ORM/EagerLoadedList.php +++ b/src/ORM/EagerLoadedList.php @@ -3,12 +3,19 @@ namespace SilverStripe\ORM; use SilverStripe\Dev\Debug; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\FieldType\DBField; use BadMethodCallException; use InvalidArgumentException; use LogicException; +use SilverStripe\Core\ArrayLib; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\Filterable; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\Map; +use SilverStripe\Model\List\Sortable; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\Filters\SearchFilterable; use Traversable; @@ -29,7 +36,7 @@ * @implements Sortable * @implements Limitable */ -class EagerLoadedList extends ViewableData implements Relation, SS_List, Filterable, Sortable, Limitable +class EagerLoadedList extends ModelData implements Relation, SS_List, Filterable, Sortable, Limitable { use SearchFilterable; diff --git a/src/ORM/FieldType/DBBoolean.php b/src/ORM/FieldType/DBBoolean.php index 034a047ee67..c4d4c1c4870 100644 --- a/src/ORM/FieldType/DBBoolean.php +++ b/src/ORM/FieldType/DBBoolean.php @@ -6,7 +6,7 @@ use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FormField; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a boolean field. @@ -44,7 +44,7 @@ public function NiceAsBoolean(): string return ($this->value) ? 'true' : 'false'; } - public function saveInto(ViewableData $dataObject): void + public function saveInto(ModelData $dataObject): void { $fieldName = $this->name; if ($fieldName) { diff --git a/src/ORM/FieldType/DBClassNameTrait.php b/src/ORM/FieldType/DBClassNameTrait.php index 6a892b59aaf..7755e5fc3a0 100644 --- a/src/ORM/FieldType/DBClassNameTrait.php +++ b/src/ORM/FieldType/DBClassNameTrait.php @@ -6,7 +6,7 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; trait DBClassNameTrait { @@ -98,7 +98,7 @@ public function getEnum(): array return array_values($classNames ?? []); } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { parent::setValue($value, $record, $markChanged); diff --git a/src/ORM/FieldType/DBComposite.php b/src/ORM/FieldType/DBComposite.php index 568eb5bf67a..7060417eadc 100644 --- a/src/ORM/FieldType/DBComposite.php +++ b/src/ORM/FieldType/DBComposite.php @@ -7,7 +7,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\Queries\SQLSelect; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Extend this class when designing a {@link DBField} that doesn't have a 1-1 mapping with a database field. @@ -42,7 +42,7 @@ abstract class DBComposite extends DBField /** * Either the parent dataobject link, or a record of saved values for each field */ - protected array|ViewableData $record = []; + protected array|ModelData $record = []; public function __set(string $property, mixed $value): void { @@ -157,11 +157,11 @@ public function requireField(): void * If $record is assigned to a dataobject, this field becomes a loose wrapper over * the records on that object instead. * - * {@see ViewableData::obj} + * {@see ModelData::obj} * - * @param null|array|ViewableData $record Parent object to this field, which could be a DataObject, record array, or other + * @param null|array|ModelData $record Parent object to this field, which could be a DataObject, record array, or other */ - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $this->isChanged = $markChanged; @@ -198,7 +198,7 @@ public function bindTo(DataObject $dataObject): void $this->record = $dataObject; } - public function saveInto(ViewableData $dataObject): void + public function saveInto(ModelData $dataObject): void { foreach ($this->compositeDatabaseFields() as $field => $spec) { // Save into record diff --git a/src/ORM/FieldType/DBCurrency.php b/src/ORM/FieldType/DBCurrency.php index 20e612365d3..22d70d398dd 100644 --- a/src/ORM/FieldType/DBCurrency.php +++ b/src/ORM/FieldType/DBCurrency.php @@ -4,7 +4,7 @@ use SilverStripe\Forms\CurrencyField; use SilverStripe\Forms\FormField; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a decimal field containing a currency amount. @@ -51,7 +51,7 @@ public function Whole(): string return $val; } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $matches = null; if (is_numeric($value)) { diff --git a/src/ORM/FieldType/DBDate.php b/src/ORM/FieldType/DBDate.php index 40dcbaac963..d8a271d7878 100644 --- a/src/ORM/FieldType/DBDate.php +++ b/src/ORM/FieldType/DBDate.php @@ -11,7 +11,7 @@ use SilverStripe\ORM\DB; use SilverStripe\Security\Member; use SilverStripe\Security\Security; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a date field. @@ -42,7 +42,7 @@ class DBDate extends DBField */ public const ISO_LOCALE = 'en_US'; - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $value = $this->parseDate($value); if ($value === false) { diff --git a/src/ORM/FieldType/DBDatetime.php b/src/ORM/FieldType/DBDatetime.php index 894a70540ac..287b64690d1 100644 --- a/src/ORM/FieldType/DBDatetime.php +++ b/src/ORM/FieldType/DBDatetime.php @@ -12,7 +12,7 @@ use SilverStripe\Security\Member; use SilverStripe\Security\Security; use SilverStripe\View\TemplateGlobalProvider; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a date-time field. @@ -69,7 +69,7 @@ public function setImmutable(bool $immutable): static return $this; } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { if ($this->immutable) { // This field is set as immutable so we have to create a new field instance diff --git a/src/ORM/FieldType/DBDecimal.php b/src/ORM/FieldType/DBDecimal.php index 521ff8b95b6..deab1bcd05c 100644 --- a/src/ORM/FieldType/DBDecimal.php +++ b/src/ORM/FieldType/DBDecimal.php @@ -5,7 +5,7 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\NumericField; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a Decimal field. @@ -67,7 +67,7 @@ public function requireField(): void DB::require_field($this->tableName, $this->name, $values); } - public function saveInto(ViewableData $model): void + public function saveInto(ModelData $model): void { $fieldName = $this->name; diff --git a/src/ORM/FieldType/DBEnum.php b/src/ORM/FieldType/DBEnum.php index 7f0eaba527a..e71e6d17d9c 100644 --- a/src/ORM/FieldType/DBEnum.php +++ b/src/ORM/FieldType/DBEnum.php @@ -6,7 +6,7 @@ use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FormField; use SilverStripe\Forms\SelectField; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\Connect\MySQLDatabase; use SilverStripe\ORM\DB; diff --git a/src/ORM/FieldType/DBField.php b/src/ORM/FieldType/DBField.php index 97900eca8fd..38efb57583f 100644 --- a/src/ORM/FieldType/DBField.php +++ b/src/ORM/FieldType/DBField.php @@ -9,7 +9,7 @@ use SilverStripe\Forms\TextField; use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Queries\SQLSelect; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Single field in the database. @@ -41,7 +41,7 @@ * } * */ -abstract class DBField extends ViewableData implements DBIndexable +abstract class DBField extends ModelData implements DBIndexable { /** @@ -198,12 +198,12 @@ public function getValue(): mixed * and actually changing its values, it needs a {@link $markChanged} * parameter. * - * @param null|ViewableData|array $record An array or object that this field is part of + * @param null|ModelData|array $record An array or object that this field is part of * @param bool $markChanged Indicate whether this field should be marked changed. * Set to FALSE if you are initializing this field after construction, rather * than setting a new value. */ - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $this->value = $value; return $this; @@ -453,7 +453,7 @@ public function nullValue(): mixed /** * Saves this field to the given data object. */ - public function saveInto(ViewableData $model): void + public function saveInto(ModelData $model): void { $fieldName = $this->name; if (empty($fieldName)) { diff --git a/src/ORM/FieldType/DBForeignKey.php b/src/ORM/FieldType/DBForeignKey.php index 5f7d95f55da..c586b891f08 100644 --- a/src/ORM/FieldType/DBForeignKey.php +++ b/src/ORM/FieldType/DBForeignKey.php @@ -10,7 +10,7 @@ use SilverStripe\Forms\SearchableDropdownField; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A special type Int field used for foreign keys in has_one relationships. @@ -58,7 +58,7 @@ public function scaffoldFormField(?string $title = null, array $params = []): ?F return $field; } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { if ($record instanceof DataObject) { $this->object = $record; diff --git a/src/ORM/FieldType/DBInt.php b/src/ORM/FieldType/DBInt.php index 826e0724afb..0f46ddf54cc 100644 --- a/src/ORM/FieldType/DBInt.php +++ b/src/ORM/FieldType/DBInt.php @@ -4,10 +4,10 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\NumericField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DB; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\ArrayData; /** * Represents a signed 32 bit integer field. diff --git a/src/ORM/FieldType/DBPercentage.php b/src/ORM/FieldType/DBPercentage.php index cf703e8c140..3ceab526522 100644 --- a/src/ORM/FieldType/DBPercentage.php +++ b/src/ORM/FieldType/DBPercentage.php @@ -2,7 +2,7 @@ namespace SilverStripe\ORM\FieldType; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a decimal field from 0-1 containing a percentage value. @@ -37,7 +37,7 @@ public function Nice(): string return number_format($this->value * 100, $this->decimalSize - 2) . '%'; } - public function saveInto(ViewableData $model): void + public function saveInto(ModelData $model): void { parent::saveInto($model); diff --git a/src/ORM/FieldType/DBPolymorphicForeignKey.php b/src/ORM/FieldType/DBPolymorphicForeignKey.php index 8e5616635f3..62b7926062b 100644 --- a/src/ORM/FieldType/DBPolymorphicForeignKey.php +++ b/src/ORM/FieldType/DBPolymorphicForeignKey.php @@ -4,7 +4,7 @@ use SilverStripe\Forms\FormField; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A special ForeignKey class that handles relations with arbitrary class types @@ -61,7 +61,7 @@ public function setIDValue(int $value, bool $markChanged = true) $this->setField('ID', $value, $markChanged); } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { // Map dataobject value to array if ($value instanceof DataObject) { diff --git a/src/ORM/FieldType/DBPrimaryKey.php b/src/ORM/FieldType/DBPrimaryKey.php index 9a6f7023811..947ebae253e 100644 --- a/src/ORM/FieldType/DBPrimaryKey.php +++ b/src/ORM/FieldType/DBPrimaryKey.php @@ -5,7 +5,7 @@ use SilverStripe\Forms\FormField; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A special type Int field used for primary keys. @@ -54,7 +54,7 @@ public function scaffoldSearchField(?string $title = null): ?FormField return parent::scaffoldFormField($title); } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { parent::setValue($value, $record, $markChanged); diff --git a/src/ORM/FieldType/DBTime.php b/src/ORM/FieldType/DBTime.php index 9c64359c349..fac285be19c 100644 --- a/src/ORM/FieldType/DBTime.php +++ b/src/ORM/FieldType/DBTime.php @@ -10,7 +10,7 @@ use SilverStripe\ORM\DB; use SilverStripe\Security\Member; use SilverStripe\Security\Security; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a column in the database with the type 'Time'. @@ -29,7 +29,7 @@ class DBTime extends DBField */ public const ISO_TIME = 'HH:mm:ss'; - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $value = $this->parseTime($value); if ($value === false) { diff --git a/src/ORM/Hierarchy/Hierarchy.php b/src/ORM/Hierarchy/Hierarchy.php index 22fd043552f..929476fc778 100644 --- a/src/ORM/Hierarchy/Hierarchy.php +++ b/src/ORM/Hierarchy/Hierarchy.php @@ -6,9 +6,9 @@ use SilverStripe\Control\Controller; use SilverStripe\Core\ClassInfo; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\Core\Extension; use SilverStripe\ORM\DB; @@ -16,7 +16,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; use Exception; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * DataObjects that use the Hierarchy extension can be be organised as a hierarchy, with children and parents. The most @@ -416,7 +416,7 @@ private function getHierarchyBaseClass(): string { $ancestry = ClassInfo::ancestry($this->owner); $ancestorClass = array_shift($ancestry); - while ($ancestorClass && !ViewableData::has_extension($ancestorClass, Hierarchy::class)) { + while ($ancestorClass && !ModelData::has_extension($ancestorClass, Hierarchy::class)) { $ancestorClass = array_shift($ancestry); } diff --git a/src/ORM/Hierarchy/MarkedSet.php b/src/ORM/Hierarchy/MarkedSet.php index 464480c16fd..e05b35b791c 100644 --- a/src/ORM/Hierarchy/MarkedSet.php +++ b/src/ORM/Hierarchy/MarkedSet.php @@ -5,12 +5,12 @@ use InvalidArgumentException; use LogicException; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ArrayLib; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Core\ArrayLib; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\ArrayData; /** * Contains a set of hierarchical objects generated from a marking compilation run. diff --git a/src/ORM/RelatedData/RelatedDataService.php b/src/ORM/RelatedData/RelatedDataService.php index ecf34460297..6b83c2c419f 100644 --- a/src/ORM/RelatedData/RelatedDataService.php +++ b/src/ORM/RelatedData/RelatedDataService.php @@ -3,7 +3,7 @@ namespace SilverStripe\ORM\RelatedData; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; /** * Interface used to find all other DataObject instances that are related to a DataObject instance diff --git a/src/ORM/RelatedData/StandardRelatedDataService.php b/src/ORM/RelatedData/StandardRelatedDataService.php index c8faa8168f9..7cb43a79376 100644 --- a/src/ORM/RelatedData/StandardRelatedDataService.php +++ b/src/ORM/RelatedData/StandardRelatedDataService.php @@ -6,8 +6,8 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\ORM\DB; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Connect\Query; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectSchema; diff --git a/src/ORM/Relation.php b/src/ORM/Relation.php index 59fe4d0c4bd..62b2b266cb2 100644 --- a/src/ORM/Relation.php +++ b/src/ORM/Relation.php @@ -2,6 +2,10 @@ namespace SilverStripe\ORM; +use SilverStripe\Model\List\Filterable; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\Sortable; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\FieldType\DBField; /** diff --git a/src/ORM/Search/BasicSearchContext.php b/src/ORM/Search/BasicSearchContext.php index 9bdd960a187..c7b10685810 100644 --- a/src/ORM/Search/BasicSearchContext.php +++ b/src/ORM/Search/BasicSearchContext.php @@ -8,11 +8,11 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\Deprecation; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Filters\SearchFilter; -use SilverStripe\ORM\Limitable; -use SilverStripe\ORM\Sortable; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\Sortable; /** * A SearchContext that can be used with non-ORM data. diff --git a/src/ORM/Search/SearchContext.php b/src/ORM/Search/SearchContext.php index 0c6834353e7..90fe2b4d0b9 100644 --- a/src/ORM/Search/SearchContext.php +++ b/src/ORM/Search/SearchContext.php @@ -11,8 +11,8 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataList; use SilverStripe\ORM\Filters\SearchFilter; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; use SilverStripe\Forms\SelectField; use SilverStripe\Forms\CheckboxField; use InvalidArgumentException; diff --git a/src/ORM/UnsavedRelationList.php b/src/ORM/UnsavedRelationList.php index 76218a5e55b..e01ff241e17 100644 --- a/src/ORM/UnsavedRelationList.php +++ b/src/ORM/UnsavedRelationList.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use ArrayIterator; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBField; use Traversable; diff --git a/src/Security/AuthenticationHandler.php b/src/Security/AuthenticationHandler.php index c6e532880ea..75ec0f3f69f 100644 --- a/src/Security/AuthenticationHandler.php +++ b/src/Security/AuthenticationHandler.php @@ -3,7 +3,7 @@ namespace SilverStripe\Security; use SilverStripe\Control\HTTPRequest; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; /** * An AuthenticationHandler is responsible for providing an identity (in the form of a Member object) for diff --git a/src/Security/AuthenticationMiddleware.php b/src/Security/AuthenticationMiddleware.php index d4bd88ae07d..ba414253092 100644 --- a/src/Security/AuthenticationMiddleware.php +++ b/src/Security/AuthenticationMiddleware.php @@ -6,7 +6,7 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\Middleware\HTTPMiddleware; use SilverStripe\Core\Config\Configurable; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\ORM\Connect\DatabaseException; class AuthenticationMiddleware implements HTTPMiddleware diff --git a/src/Security/Authenticator.php b/src/Security/Authenticator.php index 856f65654e2..3a8925975e4 100644 --- a/src/Security/Authenticator.php +++ b/src/Security/Authenticator.php @@ -3,7 +3,7 @@ namespace SilverStripe\Security; use SilverStripe\Control\HTTPRequest; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\MemberAuthenticator\LoginHandler; use SilverStripe\Security\MemberAuthenticator\LogoutHandler; diff --git a/src/Security/Confirmation/Form.php b/src/Security/Confirmation/Form.php index 5b214a2715f..f52c663cfc1 100644 --- a/src/Security/Confirmation/Form.php +++ b/src/Security/Confirmation/Form.php @@ -11,7 +11,7 @@ use SilverStripe\Forms\HeaderField; use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\LabelField; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; /** * Basic confirmation form implementation. diff --git a/src/Security/Group.php b/src/Security/Group.php index a8a3a5c5f11..04466000957 100755 --- a/src/Security/Group.php +++ b/src/Security/Group.php @@ -30,7 +30,7 @@ use SilverStripe\Forms\TextField; use SilverStripe\Forms\TreeDropdownField; use SilverStripe\Forms\TreeMultiselectField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\HasManyList; diff --git a/src/Security/Member.php b/src/Security/Member.php index 1b87e2169fb..31933a662f8 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -23,18 +23,18 @@ use SilverStripe\Forms\Tab; use SilverStripe\Forms\TabSet; use SilverStripe\i18n\i18n; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\HasManyList; use SilverStripe\ORM\ManyManyList; -use SilverStripe\ORM\Map; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Map; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\UnsavedRelationList; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use Symfony\Component\Mailer\Exception\TransportExceptionInterface; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Exception\RfcComplianceException; diff --git a/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php b/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php index 467823b4d1b..bdc93e422ad 100644 --- a/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php +++ b/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php @@ -2,7 +2,7 @@ namespace SilverStripe\Security\MemberAuthenticator; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator as BaseAuthenticator; use SilverStripe\Security\Member; diff --git a/src/Security/MemberAuthenticator/ChangePasswordHandler.php b/src/Security/MemberAuthenticator/ChangePasswordHandler.php index bd027ba8de5..a2ec7b8c3ac 100644 --- a/src/Security/MemberAuthenticator/ChangePasswordHandler.php +++ b/src/Security/MemberAuthenticator/ChangePasswordHandler.php @@ -10,7 +10,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Authenticator; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\LoginAttempt; diff --git a/src/Security/MemberAuthenticator/LoginHandler.php b/src/Security/MemberAuthenticator/LoginHandler.php index db672e11c46..d7604da9c0b 100644 --- a/src/Security/MemberAuthenticator/LoginHandler.php +++ b/src/Security/MemberAuthenticator/LoginHandler.php @@ -7,7 +7,7 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\RequestHandler; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\PasswordExpirationMiddleware; use SilverStripe\Security\IdentityStore; diff --git a/src/Security/MemberAuthenticator/LogoutHandler.php b/src/Security/MemberAuthenticator/LogoutHandler.php index 9b870a259f5..99c83fba4e5 100644 --- a/src/Security/MemberAuthenticator/LogoutHandler.php +++ b/src/Security/MemberAuthenticator/LogoutHandler.php @@ -7,7 +7,7 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\RequestHandler; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\LogoutForm; use SilverStripe\Security\Member; diff --git a/src/Security/MemberAuthenticator/MemberAuthenticator.php b/src/Security/MemberAuthenticator/MemberAuthenticator.php index ec53cffebd5..b8aeee7c468 100644 --- a/src/Security/MemberAuthenticator/MemberAuthenticator.php +++ b/src/Security/MemberAuthenticator/MemberAuthenticator.php @@ -5,7 +5,7 @@ use InvalidArgumentException; use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\Extensible; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\LoginAttempt; diff --git a/src/Security/MemberAuthenticator/MemberLoginForm.php b/src/Security/MemberAuthenticator/MemberLoginForm.php index 8ce5c2b4b99..c88df53dc87 100644 --- a/src/Security/MemberAuthenticator/MemberLoginForm.php +++ b/src/Security/MemberAuthenticator/MemberLoginForm.php @@ -12,7 +12,7 @@ use SilverStripe\Forms\PasswordField; use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\LoginForm as BaseLoginForm; use SilverStripe\Security\Member; use SilverStripe\Security\RememberLoginHash; diff --git a/src/Security/PasswordValidator.php b/src/Security/PasswordValidator.php index 62288201dc0..8ab6482efc9 100644 --- a/src/Security/PasswordValidator.php +++ b/src/Security/PasswordValidator.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Extensible; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * This class represents a validator for member passwords. diff --git a/src/Security/Permission.php b/src/Security/Permission.php index 4bf6dd5bf94..0fec4b75207 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -6,10 +6,10 @@ use SilverStripe\Core\Resettable; use SilverStripe\Dev\TestOnly; use SilverStripe\i18n\i18nEntityProvider; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\View\TemplateGlobalProvider; /** @@ -375,7 +375,7 @@ public static function groupList($memberID = null) public static function grant($groupID, $code, $arg = "any") { $permissions = Permission::get()->filter(['GroupID' => $groupID, 'Code' => $code]); - + if ($permissions && $permissions->count() > 0) { $perm = $permissions->last(); } else { diff --git a/src/Security/PermissionCheckboxSetField.php b/src/Security/PermissionCheckboxSetField.php index 252cd9af1cb..bad09fa4f3b 100644 --- a/src/Security/PermissionCheckboxSetField.php +++ b/src/Security/PermissionCheckboxSetField.php @@ -5,10 +5,10 @@ use InvalidArgumentException; use SilverStripe\Core\Config\Config; use SilverStripe\Forms\FormField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use Traversable; /** diff --git a/src/Security/Security.php b/src/Security/Security.php index 80d6fe8d4bb..be3a14619e7 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -18,13 +18,13 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\Form; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\View\ArrayData; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\ArrayData; use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; use SilverStripe\View\TemplateGlobalProvider; diff --git a/src/View/AttributesHTML.php b/src/View/AttributesHTML.php index 88295046a63..2eccfac20fe 100644 --- a/src/View/AttributesHTML.php +++ b/src/View/AttributesHTML.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Convert; /** - * This trait can be applied to a ViewableData class to add the logic to render attributes in an SS template. + * This trait can be applied to a ModelData class to add the logic to render attributes in an SS template. * * When applying this trait to a class, you also need to add the following casting configuration. * ``` diff --git a/src/View/Parsers/HTMLValue.php b/src/View/Parsers/HTMLValue.php index c8c0779b34e..f7accf29542 100644 --- a/src/View/Parsers/HTMLValue.php +++ b/src/View/Parsers/HTMLValue.php @@ -3,7 +3,7 @@ namespace SilverStripe\View\Parsers; use SilverStripe\Core\Convert; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Masterminds\HTML5; use DOMNodeList; use DOMXPath; @@ -16,7 +16,7 @@ * * @mixin DOMDocument */ -class HTMLValue extends ViewableData +class HTMLValue extends ModelData { public function __construct($fragment = null) { diff --git a/src/View/SSTemplateParser.peg b/src/View/SSTemplateParser.peg index 628c4150bde..b893ef4ae5e 100644 --- a/src/View/SSTemplateParser.peg +++ b/src/View/SSTemplateParser.peg @@ -275,7 +275,7 @@ class SSTemplateParser extends Parser implements TemplateParser /** * The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to - * get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) + * get the next ModelData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) * depending on the context the lookup is used in. */ function Lookup_AddLookupStep(&$res, $sub, $method) diff --git a/src/View/SSTemplateParser.php b/src/View/SSTemplateParser.php index d9e1e15323b..4e48424898a 100644 --- a/src/View/SSTemplateParser.php +++ b/src/View/SSTemplateParser.php @@ -766,7 +766,7 @@ function Lookup__construct(&$res) /** * The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to - * get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) + * get the next ModelData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) * depending on the context the lookup is used in. */ function Lookup_AddLookupStep(&$res, $sub, $method) @@ -1187,7 +1187,7 @@ function match_QuotedString ($stack = array()) { $matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null); $_154 = NULL; do { - $stack[] = $result; $result = $this->construct( $matchrule, "q" ); + $stack[] = $result; $result = $this->construct( $matchrule, "q" ); if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -1197,7 +1197,7 @@ function match_QuotedString ($stack = array()) { $result = array_pop($stack); $_154 = FALSE; break; } - $stack[] = $result; $result = $this->construct( $matchrule, "String" ); + $stack[] = $result; $result = $this->construct( $matchrule, "String" ); if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -1840,7 +1840,7 @@ function match_PresenceCheck ($stack = array()) { $pos_255 = $this->pos; $_254 = NULL; do { - $stack[] = $result; $result = $this->construct( $matchrule, "Not" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Not" ); if (( $subres = $this->literal( 'not' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -2235,7 +2235,7 @@ function match_Require ($stack = array()) { else { $_330 = FALSE; break; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } else { $_330 = FALSE; break; } - $stack[] = $result; $result = $this->construct( $matchrule, "Call" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Call" ); $_326 = NULL; do { $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; @@ -2740,7 +2740,7 @@ function match_UncachedBlock ($stack = array()) { $_423 = NULL; do { if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); $_419 = NULL; do { $_417 = NULL; @@ -3166,7 +3166,7 @@ function match_CacheBlock ($stack = array()) { if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } else { $_555 = FALSE; break; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); + $stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); $_508 = NULL; do { $_506 = NULL; @@ -3225,7 +3225,7 @@ function match_CacheBlock ($stack = array()) { $_524 = NULL; do { if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); $_520 = NULL; do { $_518 = NULL; @@ -4165,7 +4165,7 @@ function match_ClosedBlock ($stack = array()) { unset( $pos_685 ); } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -4575,7 +4575,7 @@ function match_MalformedCloseTag ($stack = array()) { if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } else { $_743 = FALSE; break; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); $_737 = NULL; do { if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } diff --git a/src/View/SSViewer.php b/src/View/SSViewer.php index 3b82eb3fdd9..63f0edc344c 100644 --- a/src/View/SSViewer.php +++ b/src/View/SSViewer.php @@ -15,6 +15,7 @@ use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\Security\Permission; use InvalidArgumentException; +use SilverStripe\Model\ModelData; /** * Parses a template file with an *.ss file extension. @@ -324,7 +325,7 @@ public static function get_templates_by_class($classOrObject, $suffix = '', $bas /** * Get the current item being processed * - * @return ViewableData + * @return ModelData */ public static function topLevel() { @@ -549,10 +550,10 @@ public function includeRequirements($incl = true) * Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call * * @param string $cacheFile The path to the file that contains the template compiled to PHP - * @param ViewableData $item The item to use as the root scope for the template + * @param ModelData $item The item to use as the root scope for the template * @param array $overlay Any variables to layer on top of the scope * @param array $underlay Any variables to layer underneath the scope - * @param ViewableData $inheritedScope The current scope of a parent template including a sub-template + * @param ModelData $inheritedScope The current scope of a parent template including a sub-template * @return string The result of executing the template */ protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null) @@ -587,11 +588,11 @@ protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underl * * The method injects extra HTML in the header via {@link Requirements::includeInHTML()}. * - * Note: You can call this method indirectly by {@link ViewableData->renderWith()}. + * Note: You can call this method indirectly by {@link ModelData->renderWith()}. * - * @param ViewableData $item + * @param ModelData $item * @param array|null $arguments Arguments to an included template - * @param ViewableData $inheritedScope The current scope of a parent template including a sub-template + * @param ModelData $inheritedScope The current scope of a parent template including a sub-template * @return DBHTMLText Parsed template output. */ public function process($item, $arguments = null, $inheritedScope = null) diff --git a/src/View/SSViewer_BasicIteratorSupport.php b/src/View/SSViewer_BasicIteratorSupport.php index 074c8d71dc8..99d02106b96 100644 --- a/src/View/SSViewer_BasicIteratorSupport.php +++ b/src/View/SSViewer_BasicIteratorSupport.php @@ -4,7 +4,7 @@ /** * Defines an extra set of basic methods that can be used in templates - * that are not defined on sub-classes of {@link ViewableData}. + * that are not defined on sub-classes of {@link ModelData}. */ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider { diff --git a/src/View/SSViewer_DataPresenter.php b/src/View/SSViewer_DataPresenter.php index 7c5b6e5ecd0..dd8d491ef91 100644 --- a/src/View/SSViewer_DataPresenter.php +++ b/src/View/SSViewer_DataPresenter.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use SilverStripe\Core\ClassInfo; +use SilverStripe\Model\ModelData; use SilverStripe\ORM\FieldType\DBField; /** @@ -130,7 +131,7 @@ protected function getPropertiesFromProvider($interfaceToQuery, $variableMethod, if (!is_array($details)) { $details = [ 'method' => $details, - 'casting' => ViewableData::config()->uninherited('default_cast') + 'casting' => ModelData::config()->uninherited('default_cast') ]; } @@ -313,7 +314,7 @@ public function __call($name, $arguments) if ($val) { $obj = $val['obj']; if ($name === 'hasValue') { - $result = ($obj instanceof ViewableData) ? $obj->exists() : (bool)$obj; + $result = ($obj instanceof ModelData) ? $obj->exists() : (bool)$obj; } elseif (is_null($obj) || (is_scalar($obj) && !is_string($obj))) { $result = $obj; // Nulls and non-string scalars don't need casting } else { @@ -434,7 +435,7 @@ protected function castValue($value, $source) // Get provided or default cast $casting = empty($source['casting']) - ? ViewableData::config()->uninherited('default_cast') + ? ModelData::config()->uninherited('default_cast') : $source['casting']; return DBField::create_field($casting, $value); diff --git a/src/View/SSViewer_Scope.php b/src/View/SSViewer_Scope.php index 3cefaa75fe0..928b7b4a338 100644 --- a/src/View/SSViewer_Scope.php +++ b/src/View/SSViewer_Scope.php @@ -5,7 +5,7 @@ use ArrayIterator; use Countable; use Iterator; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBBoolean; use SilverStripe\ORM\FieldType\DBText; use SilverStripe\ORM\FieldType\DBFloat; @@ -16,7 +16,7 @@ * This tracks the current scope for an SSViewer instance. It has three goals: * - Handle entering & leaving sub-scopes in loops and withs * - Track Up and Top - * - (As a side effect) Inject data that needs to be available globally (used to live in ViewableData) + * - (As a side effect) Inject data that needs to be available globally (used to live in ModelData) * * In order to handle up, rather than tracking it using a tree, which would involve constructing new objects * for each step, we use indexes into the itemStack (which already has to exist). @@ -132,7 +132,7 @@ public function getItem() $item = $this->convertScalarToDBField($item); } - // Wrap list arrays in ViewableData so templates can handle them + // Wrap list arrays in ModelData so templates can handle them if (is_array($item) && array_is_list($item)) { $item = ArrayList::create($item); } diff --git a/src/View/Shortcodes/EmbedShortcodeProvider.php b/src/View/Shortcodes/EmbedShortcodeProvider.php index 89806d6bc26..ed23d778cae 100644 --- a/src/View/Shortcodes/EmbedShortcodeProvider.php +++ b/src/View/Shortcodes/EmbedShortcodeProvider.php @@ -8,9 +8,9 @@ use Psr\SimpleCache\InvalidArgumentException; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\Embed\Embeddable; use SilverStripe\View\HTML; use SilverStripe\View\Parsers\ShortcodeHandler; diff --git a/src/View/TemplateGlobalProvider.php b/src/View/TemplateGlobalProvider.php index d1363df5b32..84b6d7ea416 100644 --- a/src/View/TemplateGlobalProvider.php +++ b/src/View/TemplateGlobalProvider.php @@ -19,7 +19,7 @@ interface TemplateGlobalProvider * If the method to call is not included for a particular template variable, a method named the same as the * template variable will be called * - * If the casting class is not specified for a particular template variable, ViewableData::$default_cast is used + * If the casting class is not specified for a particular template variable, ModelData::$default_cast is used * * The first letter of the template variable is case-insensitive. However the method name is always case sensitive. * diff --git a/src/View/TemplateIteratorProvider.php b/src/View/TemplateIteratorProvider.php index f2930bc62fd..a3169afadd7 100644 --- a/src/View/TemplateIteratorProvider.php +++ b/src/View/TemplateIteratorProvider.php @@ -19,7 +19,7 @@ interface TemplateIteratorProvider * If the method to call is not included for a particular template variable, a method named the same as the * template variable will be called * - * If the casting class is not specified for a particular template variable, ViewableData::$default_cast is used + * If the casting class is not specified for a particular template variable, ModelData::$default_cast is used * * The first letter of the template variable is case-insensitive. However the method name is always case sensitive. * diff --git a/tests/php/Control/Email/EmailTest.php b/tests/php/Control/Email/EmailTest.php index e05cf91a434..9a0c68e179d 100644 --- a/tests/php/Control/Email/EmailTest.php +++ b/tests/php/Control/Email/EmailTest.php @@ -11,7 +11,7 @@ use SilverStripe\Dev\TestMailer; use SilverStripe\Security\Member; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Part\DataPart; @@ -394,12 +394,12 @@ public function testDataWithArray(): void $this->assertSame('My content', $email->getData()->Content); } - public function testDataWithViewableData(): void + public function testDataWithModelData(): void { $email = new Email(); - $viewableData = new ViewableData(); - $viewableData->ABC = 'XYZ'; - $email->setData($viewableData); + $model = new ModelData(); + $model->ABC = 'XYZ'; + $email->setData($model); $data = $email->getData(); $this->assertSame('XYZ', $data->ABC); $this->assertSame(true, $data->IsEmail); diff --git a/tests/php/Control/RSS/RSSFeedTest.php b/tests/php/Control/RSS/RSSFeedTest.php index 8392dd49599..ac831f655f5 100644 --- a/tests/php/Control/RSS/RSSFeedTest.php +++ b/tests/php/Control/RSS/RSSFeedTest.php @@ -6,7 +6,7 @@ use SilverStripe\Control\RSS\RSSFeed; use SilverStripe\Core\Config\Config; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\View\Parsers\ShortcodeParser; class RSSFeedTest extends SapphireTest diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemA.php b/tests/php/Control/RSS/RSSFeedTest/ItemA.php index 78a69dc05f6..cdce0415f3f 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemA.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemA.php @@ -3,9 +3,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; use SilverStripe\Control\Controller; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemA extends ViewableData +class ItemA extends ModelData { // RSS-feed items must have $casting/$db information. private static $casting = [ diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemB.php b/tests/php/Control/RSS/RSSFeedTest/ItemB.php index 87c33118d0d..ee0f604ac56 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemB.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemB.php @@ -2,9 +2,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemB extends ViewableData +class ItemB extends ModelData { // ItemB tests without $casting diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemC.php b/tests/php/Control/RSS/RSSFeedTest/ItemC.php index 0edcd9adaa5..17011648b7b 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemC.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemC.php @@ -2,9 +2,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemC extends ViewableData +class ItemC extends ModelData { // ItemC tests fields - Title has casting, Content doesn't. private static $casting = [ diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemD.php b/tests/php/Control/RSS/RSSFeedTest/ItemD.php index c44914b602f..323444620aa 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemD.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemD.php @@ -2,9 +2,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemD extends ViewableData +class ItemD extends ModelData { // ItemD test fields - all fields use casting but Content & AltContent cast as HTMLText private static $casting = [ diff --git a/tests/php/Control/RequestHandlingTest/ControllerFailover.php b/tests/php/Control/RequestHandlingTest/ControllerFailover.php index 846458f1583..bf90fbf84fd 100644 --- a/tests/php/Control/RequestHandlingTest/ControllerFailover.php +++ b/tests/php/Control/RequestHandlingTest/ControllerFailover.php @@ -3,9 +3,9 @@ namespace SilverStripe\Control\Tests\RequestHandlingTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ControllerFailover extends ViewableData implements TestOnly +class ControllerFailover extends ModelData implements TestOnly { public function failoverMethod() { diff --git a/tests/php/ORM/ArrayLibTest.php b/tests/php/Core/ArrayLibTest.php similarity index 99% rename from tests/php/ORM/ArrayLibTest.php rename to tests/php/Core/ArrayLibTest.php index c8732e35ed1..bc55dfd27cf 100644 --- a/tests/php/ORM/ArrayLibTest.php +++ b/tests/php/Core/ArrayLibTest.php @@ -3,7 +3,7 @@ namespace SilverStripe\ORM\Tests; use PHPUnit\Framework\ExpectationFailedException; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\Dev\SapphireTest; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/Core/ClassInfoTest.php b/tests/php/Core/ClassInfoTest.php index 97baf8f0bc1..2c16776a37d 100644 --- a/tests/php/Core/ClassInfoTest.php +++ b/tests/php/Core/ClassInfoTest.php @@ -23,7 +23,7 @@ use SilverStripe\Core\Tests\ClassInfoTest\WithRelation; use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use PHPUnit\Framework\Attributes\DataProvider; class ClassInfoTest extends SapphireTest @@ -150,7 +150,7 @@ public function testAncestry() { $ancestry = ClassInfo::ancestry(ChildClass::class); $expect = [ - 'silverstripe\\view\\viewabledata' => ViewableData::class, + 'silverstripe\\model\\modeldata' => ModelData::class, 'silverstripe\\orm\\dataobject' => DataObject::class, 'silverstripe\\core\tests\classinfotest\\baseclass' => BaseClass::class, 'silverstripe\\core\tests\classinfotest\\childclass' => ChildClass::class, diff --git a/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php b/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php index 9dd413cbfb6..1c7dfd8da3a 100644 --- a/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php +++ b/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php @@ -3,12 +3,12 @@ namespace SilverStripe\Core\Tests\Injector\InjectorTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** - * Make sure DI works with ViewableData's implementation of __isset + * Make sure DI works with ModelData's implementation of __isset */ -class TestSetterInjections extends ViewableData implements TestOnly +class TestSetterInjections extends ModelData implements TestOnly { protected $backend; diff --git a/tests/php/ORM/ValidationExceptionTest.php b/tests/php/Core/Validation/ValidationExceptionTest.php similarity index 98% rename from tests/php/ORM/ValidationExceptionTest.php rename to tests/php/Core/Validation/ValidationExceptionTest.php index 28253e297fb..dbc23b1de33 100644 --- a/tests/php/ORM/ValidationExceptionTest.php +++ b/tests/php/Core/Validation/ValidationExceptionTest.php @@ -1,9 +1,9 @@ 'Ingo', @@ -53,7 +53,7 @@ public static function provideInvalidMatchesForList() #[DataProvider('provideMatchesForList')] public function testEvaluateMatchesCorrectlyArrayData($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = ArrayData::create($this->test_data); @@ -66,7 +66,7 @@ public function testEvaluateMatchesCorrectlyArrayData($match) #[DataProvider('provideMatchesForList')] public function testEvaluateMatchesCorrectlyDataObject($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = Member::create($this->test_data); @@ -79,7 +79,7 @@ public function testEvaluateMatchesCorrectlyDataObject($match) #[DataProvider('provideInvalidMatchesForList')] public function testEvaluateDoesNotMatchWrongMatchInArrayData($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = ArrayData::create($this->test_data); @@ -92,7 +92,7 @@ public function testEvaluateDoesNotMatchWrongMatchInArrayData($match) #[DataProvider('provideInvalidMatchesForList')] public function testEvaluateDoesNotMatchWrongMatchInDataObject($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = Member::create($this->test_data); @@ -102,10 +102,10 @@ public function testEvaluateDoesNotMatchWrongMatchInDataObject($match) public function testFieldAccess() { $data = new TestObject(['name' => 'Damian']); - $constraint = new ViewableDataContains(['name' => 'Damian', 'Something' => 'something']); + $constraint = new ModelDataContains(['name' => 'Damian', 'Something' => 'something']); $this->assertTrue($constraint->evaluate($data, '', true)); - $constraint = new ViewableDataContains(['name' => 'Damian', 'Something' => 'notthing']); + $constraint = new ModelDataContains(['name' => 'Damian', 'Something' => 'notthing']); $this->assertFalse($constraint->evaluate($data, '', true)); } } diff --git a/tests/php/Dev/SSListContainsOnlyMatchingItemsTest.php b/tests/php/Dev/SSListContainsOnlyMatchingItemsTest.php index a1824ef7b88..b3cf2539895 100644 --- a/tests/php/Dev/SSListContainsOnlyMatchingItemsTest.php +++ b/tests/php/Dev/SSListContainsOnlyMatchingItemsTest.php @@ -5,7 +5,7 @@ use SilverStripe\Dev\Constraint\SSListContainsOnly; use SilverStripe\Dev\Constraint\SSListContainsOnlyMatchingItems; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Security\Member; class SSListContainsOnlyMatchingItemsTest extends SapphireTest diff --git a/tests/php/Dev/SSListContainsOnlyTest.php b/tests/php/Dev/SSListContainsOnlyTest.php index 3f184175ab6..1ed336fe7d3 100644 --- a/tests/php/Dev/SSListContainsOnlyTest.php +++ b/tests/php/Dev/SSListContainsOnlyTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\Constraint\SSListContainsOnly; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Security\Member; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/Dev/SSListContainsTest.php b/tests/php/Dev/SSListContainsTest.php index 0c79553129a..e4ffd11c4a9 100644 --- a/tests/php/Dev/SSListContainsTest.php +++ b/tests/php/Dev/SSListContainsTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\Constraint\SSListContains; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Security\Member; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/Dev/SapphireTestTest.php b/tests/php/Dev/SapphireTestTest.php index 94d53bef123..cee251278ab 100644 --- a/tests/php/Dev/SapphireTestTest.php +++ b/tests/php/Dev/SapphireTestTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Security\Member; use SilverStripe\Security\Permission; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/Dev/ViewableDataContainsTest/TestObject.php b/tests/php/Dev/ViewableDataContainsTest/TestObject.php index 658cae21040..70a16e723fd 100644 --- a/tests/php/Dev/ViewableDataContainsTest/TestObject.php +++ b/tests/php/Dev/ViewableDataContainsTest/TestObject.php @@ -1,11 +1,11 @@ method('getHTMLID') ->willReturn($formName); - + $source = [ 'first' => 'value', 0 => 'otherValue' diff --git a/tests/php/Forms/EmailFieldTest/TestValidator.php b/tests/php/Forms/EmailFieldTest/TestValidator.php index f3557d83414..21e00a989aa 100644 --- a/tests/php/Forms/EmailFieldTest/TestValidator.php +++ b/tests/php/Forms/EmailFieldTest/TestValidator.php @@ -4,7 +4,7 @@ use Exception; use SilverStripe\Forms\Validator; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; class TestValidator extends Validator { diff --git a/tests/php/Forms/EnumFieldTest.php b/tests/php/Forms/EnumFieldTest.php index deb3d69be55..8e77426ff2b 100644 --- a/tests/php/Forms/EnumFieldTest.php +++ b/tests/php/Forms/EnumFieldTest.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\Tests; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\FieldType\DBEnum; use SilverStripe\Dev\SapphireTest; diff --git a/tests/php/Forms/FormFieldTest.php b/tests/php/Forms/FormFieldTest.php index 8050f1c64ac..95ad6f7f580 100644 --- a/tests/php/Forms/FormFieldTest.php +++ b/tests/php/Forms/FormFieldTest.php @@ -31,7 +31,7 @@ use SilverStripe\Forms\ToggleCompositeField; use SilverStripe\Forms\TreeDropdownField; use SilverStripe\Forms\TreeDropdownField_Readonly; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Group; use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionCheckboxSetField; diff --git a/tests/php/Forms/FormTest.php b/tests/php/Forms/FormTest.php index 55c79798ec0..c529145494b 100644 --- a/tests/php/Forms/FormTest.php +++ b/tests/php/Forms/FormTest.php @@ -27,11 +27,11 @@ use SilverStripe\Forms\TextareaField; use SilverStripe\Forms\TextField; use SilverStripe\Forms\TimeField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\NullSecurityToken; use SilverStripe\Security\RandomGenerator; use SilverStripe\Security\SecurityToken; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\SSViewer; use PHPUnit\Framework\Attributes\DataProvider; @@ -765,9 +765,9 @@ public function testSubmitFormWithSpecifiedParameters( ): void { $this->get('FormTest_ControllerWithSecurityToken'); - + [ $form, $button, $data, $withSecurityToken ] = [ ...$formData ]; - + if (is_null($button)) { $response = $this->submitForm($form, $button, $data, $withSecurityToken); $this->assertEquals($statusCode, $response->getStatusCode(), $testMessage); diff --git a/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php b/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php index a39626d37e5..538261bd6c9 100644 --- a/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php +++ b/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php @@ -14,8 +14,8 @@ use SilverStripe\Forms\NumericField; use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\View\SSViewer; class ControllerWithSpecialSubmittedValueFields extends Controller implements TestOnly diff --git a/tests/php/Forms/FormTest/TestController.php b/tests/php/Forms/FormTest/TestController.php index 4e514d83da9..a9ca0a1259d 100644 --- a/tests/php/Forms/FormTest/TestController.php +++ b/tests/php/Forms/FormTest/TestController.php @@ -13,8 +13,8 @@ use SilverStripe\Forms\NumericField; use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\View\SSViewer; class TestController extends Controller implements TestOnly diff --git a/tests/php/Forms/GridField/GridFieldActionMenuTest.php b/tests/php/Forms/GridField/GridFieldActionMenuTest.php index 118b092bf45..2e8c5e43756 100644 --- a/tests/php/Forms/GridField/GridFieldActionMenuTest.php +++ b/tests/php/Forms/GridField/GridFieldActionMenuTest.php @@ -17,7 +17,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\Security\Member; use SilverStripe\Security\Security; diff --git a/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php b/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php index e58d30837a5..308ab4548d0 100644 --- a/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php +++ b/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php @@ -17,8 +17,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Stadium; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; class GridFieldAddExistingAutocompleterTest extends FunctionalTest { diff --git a/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php b/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php index f599012b01c..7e82d8c53bf 100644 --- a/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php @@ -15,9 +15,9 @@ use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PeopleGroup; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Category; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\ArrayData; class GridFieldAddNewButtonTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldConfigTest.php b/tests/php/Forms/GridField/GridFieldConfigTest.php index 669fcb09717..7cc7c4d7ced 100644 --- a/tests/php/Forms/GridField/GridFieldConfigTest.php +++ b/tests/php/Forms/GridField/GridFieldConfigTest.php @@ -4,7 +4,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyOtherComponent; use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyComponent; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\Forms\GridField\GridField_URLHandler; diff --git a/tests/php/Forms/GridField/GridFieldDataColumnsTest.php b/tests/php/Forms/GridField/GridFieldDataColumnsTest.php index 8fc829dccd2..44c51f78073 100644 --- a/tests/php/Forms/GridField/GridFieldDataColumnsTest.php +++ b/tests/php/Forms/GridField/GridFieldDataColumnsTest.php @@ -9,8 +9,8 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldConfig_Base; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; use stdClass; class GridFieldDataColumnsTest extends SapphireTest diff --git a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php index 8e28e65056c..63627f2246b 100644 --- a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php +++ b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php @@ -20,12 +20,12 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Security; use SilverStripe\Security\SecurityToken; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use PHPUnit\Framework\Attributes\DataProvider; class GridFieldDeleteActionTest extends SapphireTest diff --git a/tests/php/Forms/GridField/GridFieldDetailFormTest.php b/tests/php/Forms/GridField/GridFieldDetailFormTest.php index eade6fb7f5f..ba43886e000 100644 --- a/tests/php/Forms/GridField/GridFieldDetailFormTest.php +++ b/tests/php/Forms/GridField/GridFieldDetailFormTest.php @@ -24,8 +24,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Person; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PolymorphicPeopleGroup; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; use PHPUnit\Framework\Attributes\DataProvider; class GridFieldDetailFormTest extends FunctionalTest diff --git a/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php b/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php index 00fed3896c1..f6f07fcc795 100644 --- a/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php +++ b/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class ArrayDataWithID extends ArrayData implements TestOnly { diff --git a/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php b/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php index a50715e7377..431a5bdba43 100644 --- a/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php +++ b/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php @@ -13,7 +13,7 @@ use SilverStripe\Forms\GridField\GridFieldEditButton; use SilverStripe\Forms\GridField\GridFieldToolbarHeader; use SilverStripe\Forms\GridField\GridFieldViewButton; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; class TestController extends Controller implements TestOnly { diff --git a/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php b/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php index 0a13a074970..0ccd4ee44e5 100644 --- a/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php +++ b/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php @@ -9,8 +9,8 @@ use SilverStripe\Forms\GridField\GridFieldConfig_Base; use SilverStripe\Forms\GridField\GridFieldDetailForm; use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; class GridFieldDetailForm_ItemRequestTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldEditButtonTest.php b/tests/php/Forms/GridField/GridFieldEditButtonTest.php index 1d9807bfd0b..c650b7a1995 100644 --- a/tests/php/Forms/GridField/GridFieldEditButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldEditButtonTest.php @@ -6,7 +6,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\Security\Member; use SilverStripe\Dev\CSSContentParser; diff --git a/tests/php/Forms/GridField/GridFieldExportButtonTest.php b/tests/php/Forms/GridField/GridFieldExportButtonTest.php index 2f4c9078c59..9ec0d38ce48 100644 --- a/tests/php/Forms/GridField/GridFieldExportButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldExportButtonTest.php @@ -8,7 +8,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\NoView; use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\Team; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridFieldConfig; @@ -17,7 +17,7 @@ use SilverStripe\Forms\GridField\GridFieldDataColumns; use SilverStripe\Forms\GridField\GridFieldPaginator; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class GridFieldExportButtonTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php b/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php index ad2365165ae..7fe71abf600 100644 --- a/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php +++ b/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php @@ -18,10 +18,10 @@ use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\NonDataObject; use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\TeamGroup; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class GridFieldFilterHeaderTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php b/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php index c446dddfcda..a2cab0b6b86 100644 --- a/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php +++ b/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class NonDataObject extends ArrayData implements TestOnly { diff --git a/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php b/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php index 9789fe08c49..20ab42fc596 100644 --- a/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php +++ b/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php @@ -15,7 +15,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; class GridFieldLazyLoaderTest extends SapphireTest diff --git a/tests/php/Forms/GridField/GridFieldLevelupTest.php b/tests/php/Forms/GridField/GridFieldLevelupTest.php index ffa7eeccbac..2ccc56964f4 100644 --- a/tests/php/Forms/GridField/GridFieldLevelupTest.php +++ b/tests/php/Forms/GridField/GridFieldLevelupTest.php @@ -6,7 +6,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldLevelup; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class GridFieldLevelupTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldPaginatorTest.php b/tests/php/Forms/GridField/GridFieldPaginatorTest.php index 6f6dc53a34f..f2febae4b1a 100644 --- a/tests/php/Forms/GridField/GridFieldPaginatorTest.php +++ b/tests/php/Forms/GridField/GridFieldPaginatorTest.php @@ -15,7 +15,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; class GridFieldPaginatorTest extends FunctionalTest diff --git a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php index 8b9b2f61d2b..ed73b6fcbca 100644 --- a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php @@ -14,8 +14,8 @@ use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldDataColumns; use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; class GridFieldPrintButtonTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldStateManagerTest.php b/tests/php/Forms/GridField/GridFieldStateManagerTest.php index 2e376d713ef..c17929bd99e 100644 --- a/tests/php/Forms/GridField/GridFieldStateManagerTest.php +++ b/tests/php/Forms/GridField/GridFieldStateManagerTest.php @@ -12,7 +12,7 @@ use SilverStripe\Forms\GridField\GridFieldStateManager; use SilverStripe\Forms\Form; use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class GridFieldStateManagerTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldTest.php b/tests/php/Forms/GridField/GridFieldTest.php index cf3f4d6f342..1eba6d4edf5 100644 --- a/tests/php/Forms/GridField/GridFieldTest.php +++ b/tests/php/Forms/GridField/GridFieldTest.php @@ -33,8 +33,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\ValidatorTest\TestValidator; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Group; use SilverStripe\Security\Member; use SilverStripe\Versioned\VersionedGridFieldStateExtension; diff --git a/tests/php/Forms/GridField/GridFieldTest/Component2.php b/tests/php/Forms/GridField/GridFieldTest/Component2.php index 2daedd522b8..d011a04b810 100644 --- a/tests/php/Forms/GridField/GridFieldTest/Component2.php +++ b/tests/php/Forms/GridField/GridFieldTest/Component2.php @@ -5,8 +5,8 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField_DataManipulator; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\SS_List; class Component2 implements GridField_DataManipulator, TestOnly { diff --git a/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php b/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php index 01792bc41c1..4cbdc184a42 100644 --- a/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php +++ b/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php @@ -8,7 +8,7 @@ use SilverStripe\Forms\Form; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldConfig; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; class TestController extends Controller implements TestOnly { diff --git a/tests/php/Forms/ListboxFieldTest.php b/tests/php/Forms/ListboxFieldTest.php index 085b0758fac..662918cc865 100644 --- a/tests/php/Forms/ListboxFieldTest.php +++ b/tests/php/Forms/ListboxFieldTest.php @@ -10,7 +10,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\ListboxField; use SilverStripe\Forms\RequiredFields; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class ListboxFieldTest extends SapphireTest { diff --git a/tests/php/View/ArrayDataTest.php b/tests/php/Model/ArrayDataTest.php similarity index 89% rename from tests/php/View/ArrayDataTest.php rename to tests/php/Model/ArrayDataTest.php index 4ac60b1306a..5afe410fa46 100644 --- a/tests/php/View/ArrayDataTest.php +++ b/tests/php/Model/ArrayDataTest.php @@ -1,19 +1,19 @@ new DBVarchar("A"), diff --git a/tests/php/View/ArrayDataTest/NonEmptyObject.php b/tests/php/Model/ArrayDataTest/NonEmptyObject.php similarity index 83% rename from tests/php/View/ArrayDataTest/NonEmptyObject.php rename to tests/php/Model/ArrayDataTest/NonEmptyObject.php index da4cc57e2a0..67b7c5c9821 100644 --- a/tests/php/View/ArrayDataTest/NonEmptyObject.php +++ b/tests/php/Model/ArrayDataTest/NonEmptyObject.php @@ -1,6 +1,6 @@ map('ID', 'Name'); // Items added after calling map should not be included retroactively $list->add(['ID' => 7, 'Name' => 'Andrew']); - $this->assertInstanceOf('SilverStripe\\ORM\\Map', $map); + $this->assertInstanceOf(Map::class, $map); $this->assertEquals( [ 1 => 'Steve', diff --git a/tests/php/ORM/ArrayListTest/TestObject.php b/tests/php/Model/List/ArrayListTest/TestObject.php similarity index 84% rename from tests/php/ORM/ArrayListTest/TestObject.php rename to tests/php/Model/List/ArrayListTest/TestObject.php index 842d217b109..2b2e906a5fd 100644 --- a/tests/php/ORM/ArrayListTest/TestObject.php +++ b/tests/php/Model/List/ArrayListTest/TestObject.php @@ -1,6 +1,6 @@ assertEquals('Team 1', $map[$this->idFromFixture(DataObjectTest\Team::class, 'team1')]); + $this->assertEquals('Team 1', $map[$this->idFromFixture(Team::class, 'team1')]); } public function testSetKeyFieldAndValueField() diff --git a/tests/php/Model/List/MapTest.yml b/tests/php/Model/List/MapTest.yml new file mode 100644 index 00000000000..3b9c8a4e0cf --- /dev/null +++ b/tests/php/Model/List/MapTest.yml @@ -0,0 +1,32 @@ +SilverStripe\Model\Tests\List\MapTest\Team: + team1: + Title: Team 1 + NumericField: 2 + team2: + Title: Team 2 + NumericField: 20 + team3: + Title: Team 3 + NumericField: 5 +SilverStripe\Model\Tests\List\MapTest\SubTeam: + subteam1: + Title: Subteam 1 + NumericField: 7 + ParentTeam: =>SilverStripe\Model\Tests\List\MapTest\Team.team1 + subteam2_with_player_relation: + Title: Subteam 2 + subteam3_with_empty_fields: + Title: Subteam 3 +SilverStripe\Model\Tests\List\MapTest\TeamComment: + comment1: + Name: Joe + Comment: This is a team comment by Joe + Team: =>SilverStripe\Model\Tests\List\MapTest\Team.team1 + comment2: + Name: Bob + Comment: This is a team comment by Bob + Team: =>SilverStripe\Model\Tests\List\MapTest\Team.team1 + comment3: + Name: Phil + Comment: Phil is a unique guy, and comments on team2 + Team: =>SilverStripe\Model\Tests\List\MapTest\Team.team2 diff --git a/tests/php/Model/List/MapTest/SubTeam.php b/tests/php/Model/List/MapTest/SubTeam.php new file mode 100644 index 00000000000..52006aee5e7 --- /dev/null +++ b/tests/php/Model/List/MapTest/SubTeam.php @@ -0,0 +1,14 @@ + Team::class, + ]; +} diff --git a/tests/php/Model/List/MapTest/Team.php b/tests/php/Model/List/MapTest/Team.php new file mode 100644 index 00000000000..4d604b4a756 --- /dev/null +++ b/tests/php/Model/List/MapTest/Team.php @@ -0,0 +1,39 @@ + 'Varchar', + 'DatabaseField' => 'HTMLVarchar', + 'NumericField' => 'Int', + ]; + + private static $has_many = [ + 'SubTeams' => SubTeam::class, + 'Comments' => TeamComment::class, + ]; + + private static $default_sort = '"Title"'; + + public function MyTitle() + { + return 'Team ' . $this->Title; + } +} diff --git a/tests/php/Model/List/MapTest/TeamComment.php b/tests/php/Model/List/MapTest/TeamComment.php new file mode 100644 index 00000000000..30e7456af73 --- /dev/null +++ b/tests/php/Model/List/MapTest/TeamComment.php @@ -0,0 +1,22 @@ + 'Varchar', + 'Comment' => 'Text' + ]; + + private static $has_one = [ + 'Team' => Team::class + ]; + + private static $default_sort = '"Name" ASC'; +} diff --git a/tests/php/ORM/PaginatedListTest.php b/tests/php/Model/List/PaginatedListTest.php similarity index 97% rename from tests/php/ORM/PaginatedListTest.php rename to tests/php/Model/List/PaginatedListTest.php index 0f26f6fa91d..6c6e7743976 100644 --- a/tests/php/ORM/PaginatedListTest.php +++ b/tests/php/Model/List/PaginatedListTest.php @@ -1,30 +1,28 @@ 'Boolean', + 'ShirtNumber' => 'Varchar', + ]; + + private static $searchable_fields = [ + 'IsRetired', + 'ShirtNumber' + ]; +} diff --git a/tests/php/Model/ModelDataCustomisedTest.php b/tests/php/Model/ModelDataCustomisedTest.php new file mode 100644 index 00000000000..cbdb88046df --- /dev/null +++ b/tests/php/Model/ModelDataCustomisedTest.php @@ -0,0 +1,55 @@ +makeOuterOriginal(), $this->makeInnerModelDataCustomised()); + $this->assertThat($outerCustomised, $this->makeTestConstraint()); + } + + public function testNestedModelDataCustomisedAsOriginal() + { + $outerCustomised = ModelDataCustomised::create($this->makeInnerModelDataCustomised(), $this->makeOuterOriginal()); + $this->assertThat($outerCustomised, $this->makeTestConstraint()); + } + + private function makeTestConstraint() + { + return new ModelDataContains([ + 'outerOriginal' => 'foobar', + 'innerOriginal' => 'hello', + 'innerCustomised' => 'world', + ]); + } + + private function makeOuterOriginal() + { + return ArrayData::create([ + 'outerOriginal' => 'foobar', + ]); + } + + private function makeInnerModelDataCustomised() + { + $original = ArrayData::create([ + 'innerOriginal' => 'hello', + ]); + + $customised = ArrayData::create([ + 'innerCustomised' => 'world', + ]); + + return ModelDataCustomised::create($original, $customised); + } +} diff --git a/tests/php/View/ViewableDataTest.php b/tests/php/Model/ModelDataTest.php similarity index 70% rename from tests/php/View/ViewableDataTest.php rename to tests/php/Model/ModelDataTest.php index 69b93d3b77d..33f4b171d3a 100644 --- a/tests/php/View/ViewableDataTest.php +++ b/tests/php/Model/ModelDataTest.php @@ -1,28 +1,27 @@ testCastingHelpers()} for more tests related to casting and ViewableData behaviour, + * See {@link SSViewerTest->testCastingHelpers()} for more tests related to casting and ModelData behaviour, * from a template-parsing perspective. */ -class ViewableDataTest extends SapphireTest +class ModelDataTest extends SapphireTest { protected static $required_extensions = [ - ViewableDataTestObject::class => [ - ViewableDataTestExtension::class, + ModelDataTestObject::class => [ + ModelDataTestExtension::class, ], ]; @@ -57,10 +56,10 @@ public function testCasting() public function testRequiresCasting() { - $caster = new ViewableDataTest\Castable(); + $caster = new ModelDataTest\Castable(); - $this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); - $this->assertInstanceOf(ViewableDataTest\Caster::class, $caster->obj('noCastingInformation')); + $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); + $this->assertInstanceOf(ModelDataTest\Caster::class, $caster->obj('noCastingInformation')); $this->assertInstanceOf(DBText::class, $caster->obj('arrayOne')); $this->assertInstanceOf(ArrayList::class, $caster->obj('arrayTwo')); @@ -68,20 +67,20 @@ public function testRequiresCasting() public function testFailoverRequiresCasting() { - $caster = new ViewableDataTest\Castable(); - $container = new ViewableDataTest\Container(); + $caster = new ModelDataTest\Castable(); + $container = new ModelDataTest\Container(); $container->setFailover($caster); - $this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $container->obj('alwaysCasted')); - $this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); + $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $container->obj('alwaysCasted')); + $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); - $this->assertInstanceOf(ViewableDataTest\Caster::class, $container->obj('noCastingInformation')); - $this->assertInstanceOf(ViewableDataTest\Caster::class, $caster->obj('noCastingInformation')); + $this->assertInstanceOf(ModelDataTest\Caster::class, $container->obj('noCastingInformation')); + $this->assertInstanceOf(ModelDataTest\Caster::class, $caster->obj('noCastingInformation')); } public function testCastingXMLVal() { - $caster = new ViewableDataTest\Castable(); + $caster = new ModelDataTest\Castable(); $this->assertEquals('casted', $caster->XML_val('alwaysCasted')); $this->assertEquals('casted', $caster->XML_val('noCastingInformation')); @@ -93,43 +92,43 @@ public function testCastingXMLVal() public function testArrayCustomise() { - $viewableData = new ViewableDataTest\Castable(); - $newViewableData = $viewableData->customise( + $modelData = new ModelDataTest\Castable(); + $newModelData = $modelData->customise( [ 'test' => 'overwritten', 'alwaysCasted' => 'overwritten' ] ); - $this->assertEquals('test', $viewableData->XML_val('test')); - $this->assertEquals('casted', $viewableData->XML_val('alwaysCasted')); + $this->assertEquals('test', $modelData->XML_val('test')); + $this->assertEquals('casted', $modelData->XML_val('alwaysCasted')); - $this->assertEquals('overwritten', $newViewableData->XML_val('test')); - $this->assertEquals('overwritten', $newViewableData->XML_val('alwaysCasted')); + $this->assertEquals('overwritten', $newModelData->XML_val('test')); + $this->assertEquals('overwritten', $newModelData->XML_val('alwaysCasted')); - $this->assertEquals('castable', $viewableData->forTemplate()); - $this->assertEquals('castable', $newViewableData->forTemplate()); + $this->assertEquals('castable', $modelData->forTemplate()); + $this->assertEquals('castable', $newModelData->forTemplate()); } public function testObjectCustomise() { - $viewableData = new ViewableDataTest\Castable(); - $newViewableData = $viewableData->customise(new ViewableDataTest\RequiresCasting()); + $modelData = new ModelDataTest\Castable(); + $newModelData = $modelData->customise(new ModelDataTest\RequiresCasting()); - $this->assertEquals('test', $viewableData->XML_val('test')); - $this->assertEquals('casted', $viewableData->XML_val('alwaysCasted')); + $this->assertEquals('test', $modelData->XML_val('test')); + $this->assertEquals('casted', $modelData->XML_val('alwaysCasted')); - $this->assertEquals('overwritten', $newViewableData->XML_val('test')); - $this->assertEquals('casted', $newViewableData->XML_val('alwaysCasted')); + $this->assertEquals('overwritten', $newModelData->XML_val('test')); + $this->assertEquals('casted', $newModelData->XML_val('alwaysCasted')); - $this->assertEquals('castable', $viewableData->forTemplate()); - $this->assertEquals('casted', $newViewableData->forTemplate()); + $this->assertEquals('castable', $modelData->forTemplate()); + $this->assertEquals('casted', $newModelData->forTemplate()); } public function testDefaultValueWrapping() { $data = new ArrayData(['Title' => 'SomeTitleValue']); - // this results in a cached raw string in ViewableData: + // this results in a cached raw string in ModelData: $this->assertTrue($data->hasValue('Title')); $this->assertFalse($data->hasValue('SomethingElse')); // this should cast the raw string to a StringField since we are @@ -148,7 +147,7 @@ public function testCastingClass() 'Argument' => 'ArgumentType', 'ArrayArgument' => 'ArrayArgumentType' ]; - $obj = new ViewableDataTest\CastingClass(); + $obj = new ModelDataTest\CastingClass(); foreach ($expected as $field => $class) { $this->assertEquals( @@ -161,7 +160,7 @@ public function testCastingClass() public function testObjWithCachedStringValueReturnsValidObject() { - $obj = new ViewableDataTest\NoCastingInformation(); + $obj = new ModelDataTest\NoCastingInformation(); // Save a literal string into cache $cache = true; @@ -184,8 +183,8 @@ public function testObjWithCachedStringValueReturnsValidObject() public function testCaching() { - $objCached = new ViewableDataTest\Cached(); - $objNotCached = new ViewableDataTest\NotCached(); + $objCached = new ModelDataTest\Cached(); + $objNotCached = new ModelDataTest\NotCached(); $objCached->Test = 'AAA'; $objNotCached->Test = 'AAA'; @@ -203,15 +202,15 @@ public function testCaching() public function testSetFailover() { - $failover = new ViewableData(); - $container = new ViewableDataTest\Container(); + $failover = new ModelData(); + $container = new ModelDataTest\Container(); $container->setFailover($failover); $this->assertSame($failover, $container->getFailover(), 'getFailover() returned a different object'); $this->assertFalse($container->hasMethod('testMethod'), 'testMethod() is already defined when it shouldn’t be'); // Ensure that defined methods detected from the failover aren't cached when setting a new failover - $container->setFailover(new ViewableDataTest\Failover); + $container->setFailover(new ModelDataTest\Failover); $this->assertTrue($container->hasMethod('testMethod')); // Test the reverse - that defined methods previously detected in a failover are removed if they no longer exist @@ -222,10 +221,10 @@ public function testSetFailover() public function testIsAccessibleMethod() { - $reflectionMethod = new ReflectionMethod(ViewableData::class, 'isAccessibleMethod'); + $reflectionMethod = new ReflectionMethod(ModelData::class, 'isAccessibleMethod'); $reflectionMethod->setAccessible(true); - $object = new ViewableDataTestObject(); - $viewableData = new ViewableData(); + $object = new ModelDataTestObject(); + $modelData = new ModelData(); $output = $reflectionMethod->invokeArgs($object, ['privateMethod']); $this->assertFalse($output, 'Method should not be accessible'); @@ -239,7 +238,7 @@ public function testIsAccessibleMethod() $output = $reflectionMethod->invokeArgs($object, ['missingMethod']); $this->assertFalse($output, 'Method should not be accessible'); - $output = $reflectionMethod->invokeArgs($viewableData, ['isAccessibleProperty']); + $output = $reflectionMethod->invokeArgs($modelData, ['isAccessibleProperty']); $this->assertTrue($output, 'Method should be accessible'); $output = $reflectionMethod->invokeArgs($object, ['publicMethodFromExtension']); @@ -254,9 +253,9 @@ public function testIsAccessibleMethod() public function testIsAccessibleProperty() { - $reflectionMethod = new ReflectionMethod(ViewableData::class, 'isAccessibleProperty'); + $reflectionMethod = new ReflectionMethod(ModelData::class, 'isAccessibleProperty'); $reflectionMethod->setAccessible(true); - $object = new ViewableDataTestObject(); + $object = new ModelDataTestObject(); $output = $reflectionMethod->invokeArgs($object, ['privateProperty']); $this->assertFalse($output, 'Property should not be accessible'); @@ -270,19 +269,19 @@ public function testIsAccessibleProperty() $output = $reflectionMethod->invokeArgs($object, ['missingProperty']); $this->assertFalse($output, 'Property should not be accessible'); - $output = $reflectionMethod->invokeArgs(new ViewableData(), ['objCache']); + $output = $reflectionMethod->invokeArgs(new ModelData(), ['objCache']); $this->assertTrue($output, 'Property should be accessible'); } public function testDynamicData() { $obj = (object) ['SomeField' => [1, 2, 3]]; - $viewableData = new ViewableData(); - $this->assertFalse($viewableData->hasDynamicData('abc')); - $viewableData->setDynamicData('abc', $obj); - $this->assertTrue($viewableData->hasDynamicData('abc')); - $this->assertSame($obj, $viewableData->getDynamicData('abc')); - $this->assertSame($obj, $viewableData->abc); + $modelData = new ModelData(); + $this->assertFalse($modelData->hasDynamicData('abc')); + $modelData->setDynamicData('abc', $obj); + $this->assertTrue($modelData->hasDynamicData('abc')); + $this->assertSame($obj, $modelData->getDynamicData('abc')); + $this->assertSame($obj, $modelData->abc); } public static function provideWrapArrayInObj(): array @@ -305,8 +304,8 @@ public static function provideWrapArrayInObj(): array #[DataProvider('provideWrapArrayInObj')] public function testWrapArrayInObj(array $arr, string $expectedClass): void { - $viewableData = new ViewableData(); - $viewableData->arr = $arr; - $this->assertInstanceOf($expectedClass, $viewableData->obj('arr')); + $modelData = new ModelData(); + $modelData->arr = $arr; + $this->assertInstanceOf($expectedClass, $modelData->obj('arr')); } } diff --git a/tests/php/Model/ModelDataTest/Cached.php b/tests/php/Model/ModelDataTest/Cached.php new file mode 100644 index 00000000000..7878fba16fb --- /dev/null +++ b/tests/php/Model/ModelDataTest/Cached.php @@ -0,0 +1,11 @@ + 'CastingType', diff --git a/tests/php/Model/ModelDataTest/Container.php b/tests/php/Model/ModelDataTest/Container.php new file mode 100644 index 00000000000..9b5b5540852 --- /dev/null +++ b/tests/php/Model/ModelDataTest/Container.php @@ -0,0 +1,11 @@ +saveIntoCalledCount++; parent::saveInto($model); diff --git a/tests/php/ORM/DataListEagerLoadingTest.php b/tests/php/ORM/DataListEagerLoadingTest.php index abab2fbb909..9eb5a87fc7b 100644 --- a/tests/php/ORM/DataListEagerLoadingTest.php +++ b/tests/php/ORM/DataListEagerLoadingTest.php @@ -12,7 +12,7 @@ use SilverStripe\ORM\DB; use SilverStripe\ORM\EagerLoadedList; use SilverStripe\ORM\ManyManyThroughList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\EagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\EagerLoadSubClassObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\HasOneEagerLoadObject; diff --git a/tests/php/ORM/DataListTest.php b/tests/php/ORM/DataListTest.php index ca232778c54..bb67daa199e 100755 --- a/tests/php/ORM/DataListTest.php +++ b/tests/php/ORM/DataListTest.php @@ -12,7 +12,7 @@ use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DB; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Tests\DataObjectTest\DataListQueryCounter; use SilverStripe\ORM\Tests\DataObjectTest\Fixture; diff --git a/tests/php/ORM/DataObjectTest.php b/tests/php/ORM/DataObjectTest.php index d4ce517c307..9bd1735b001 100644 --- a/tests/php/ORM/DataObjectTest.php +++ b/tests/php/ORM/DataObjectTest.php @@ -22,9 +22,9 @@ use SilverStripe\ORM\Tests\DataObjectTest\Player; use SilverStripe\ORM\Tests\DataObjectTest\Team; use SilverStripe\ORM\Tests\DataObjectTest\TreeNode; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Member; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use ReflectionMethod; use stdClass; use PHPUnit\Framework\Attributes\DataProvider; @@ -1586,7 +1586,7 @@ public function testHasOwnTable() /* Return false if you don't pass it a subclass of DataObject */ $this->assertFalse($schema->classHasTable(DataObject::class)); - $this->assertFalse($schema->classHasTable(ViewableData::class)); + $this->assertFalse($schema->classHasTable(ModelData::class)); /* Invalid class name */ $this->assertFalse($schema->classHasTable("ThisIsntADataObject")); diff --git a/tests/php/ORM/DataObjectTest/ValidatedObject.php b/tests/php/ORM/DataObjectTest/ValidatedObject.php index 2482553cb6d..0912f8e7615 100644 --- a/tests/php/ORM/DataObjectTest/ValidatedObject.php +++ b/tests/php/ORM/DataObjectTest/ValidatedObject.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; class ValidatedObject extends DataObject implements TestOnly { diff --git a/tests/php/ORM/DataQueryTest.php b/tests/php/ORM/DataQueryTest.php index d4969dfe739..d6975cf8472 100644 --- a/tests/php/ORM/DataQueryTest.php +++ b/tests/php/ORM/DataQueryTest.php @@ -6,7 +6,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Tests\DataQueryTest\ObjectE; use SilverStripe\Security\Member; diff --git a/tests/php/ORM/EagerLoadedListTest.php b/tests/php/ORM/EagerLoadedListTest.php index 4a52c167176..3eca2f184ee 100644 --- a/tests/php/ORM/EagerLoadedListTest.php +++ b/tests/php/ORM/EagerLoadedListTest.php @@ -10,7 +10,7 @@ use SilverStripe\ORM\Connect\MySQLiConnector; use SilverStripe\ORM\EagerLoadedList; use SilverStripe\ORM\DB; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Tests\DataObjectTest\EquipmentCompany; use SilverStripe\ORM\Tests\DataObjectTest\Fan; use SilverStripe\ORM\Tests\DataObjectTest\Player; diff --git a/tests/php/ORM/Filters/EndsWithFilterTest.php b/tests/php/ORM/Filters/EndsWithFilterTest.php index 0adec36ae87..40c69c0e209 100644 --- a/tests/php/ORM/Filters/EndsWithFilterTest.php +++ b/tests/php/ORM/Filters/EndsWithFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\EndsWithFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/ORM/Filters/ExactMatchFilterTest.php b/tests/php/ORM/Filters/ExactMatchFilterTest.php index 42c4c4c76d9..87d71aefd8a 100644 --- a/tests/php/ORM/Filters/ExactMatchFilterTest.php +++ b/tests/php/ORM/Filters/ExactMatchFilterTest.php @@ -8,7 +8,7 @@ use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Task; use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Project; use SilverStripe\ORM\DataList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/ORM/Filters/GreaterThanFilterTest.php b/tests/php/ORM/Filters/GreaterThanFilterTest.php index 1b2cb92c286..8c753475c82 100644 --- a/tests/php/ORM/Filters/GreaterThanFilterTest.php +++ b/tests/php/ORM/Filters/GreaterThanFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\GreaterThanFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use PHPUnit\Framework\Attributes\DataProvider; class GreaterThanFilterTest extends SapphireTest diff --git a/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php b/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php index d32668c33bb..3e4e41ae447 100644 --- a/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php +++ b/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\GreaterThanOrEqualFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use PHPUnit\Framework\Attributes\DataProvider; class GreaterThanOrEqualFilterTest extends SapphireTest diff --git a/tests/php/ORM/Filters/LessThanFilterTest.php b/tests/php/ORM/Filters/LessThanFilterTest.php index 701af0eddfc..c6e7277e4ea 100644 --- a/tests/php/ORM/Filters/LessThanFilterTest.php +++ b/tests/php/ORM/Filters/LessThanFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\LessThanFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use PHPUnit\Framework\Attributes\DataProvider; class LessThanFilterTest extends SapphireTest diff --git a/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php b/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php index 961eb22e6b4..b9c1fc53b3c 100644 --- a/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php +++ b/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\LessThanOrEqualFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use PHPUnit\Framework\Attributes\DataProvider; class LessThanOrEqualFilterTest extends SapphireTest diff --git a/tests/php/ORM/Filters/PartialMatchFilterTest.php b/tests/php/ORM/Filters/PartialMatchFilterTest.php index 726592272dc..7d11ebe7c10 100644 --- a/tests/php/ORM/Filters/PartialMatchFilterTest.php +++ b/tests/php/ORM/Filters/PartialMatchFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\PartialMatchFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/ORM/Filters/StartsWithFilterTest.php b/tests/php/ORM/Filters/StartsWithFilterTest.php index 15832643ff5..32e2050ff83 100644 --- a/tests/php/ORM/Filters/StartsWithFilterTest.php +++ b/tests/php/ORM/Filters/StartsWithFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\StartsWithFilter; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/tests/php/ORM/HierarchyTest.php b/tests/php/ORM/HierarchyTest.php index c3d2e0b1258..989cedf4bbe 100644 --- a/tests/php/ORM/HierarchyTest.php +++ b/tests/php/ORM/HierarchyTest.php @@ -2,7 +2,7 @@ namespace SilverStripe\ORM\Tests; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Versioned\Versioned; use SilverStripe\Dev\SapphireTest; diff --git a/tests/php/ORM/RelatedDataServiceTest.php b/tests/php/ORM/RelatedDataServiceTest.php index 1b6bac844c0..7ec2a968222 100644 --- a/tests/php/ORM/RelatedDataServiceTest.php +++ b/tests/php/ORM/RelatedDataServiceTest.php @@ -2,7 +2,7 @@ namespace SilverStripe\ORM\Tests; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\Tests\RelatedDataServiceTest\Base; use SilverStripe\ORM\Tests\RelatedDataServiceTest\Belongs; use SilverStripe\ORM\Tests\RelatedDataServiceTest\HasMany; diff --git a/tests/php/ORM/SQLSelectTest.php b/tests/php/ORM/SQLSelectTest.php index 3dccfc9933a..7dcf386bafc 100755 --- a/tests/php/ORM/SQLSelectTest.php +++ b/tests/php/ORM/SQLSelectTest.php @@ -10,7 +10,7 @@ use SilverStripe\SQLite\SQLite3Database; use SilverStripe\PostgreSQL\PostgreSQLDatabase; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\Tests\SQLSelectTest\CteDatesObject; use SilverStripe\ORM\Tests\SQLSelectTest\CteRecursiveObject; diff --git a/tests/php/ORM/Search/BasicSearchContextTest.php b/tests/php/ORM/Search/BasicSearchContextTest.php index 8887a5fa757..6ff1575ae9e 100644 --- a/tests/php/ORM/Search/BasicSearchContextTest.php +++ b/tests/php/ORM/Search/BasicSearchContextTest.php @@ -8,12 +8,12 @@ use SilverStripe\Forms\TextField; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\HiddenField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\StartsWithFilter; use SilverStripe\ORM\Search\BasicSearchContext; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use PHPUnit\Framework\Attributes\DataProvider; class BasicSearchContextTest extends SapphireTest diff --git a/tests/php/ORM/Search/SearchContextTest.php b/tests/php/ORM/Search/SearchContextTest.php index 839de5bc96c..ec475c3c299 100644 --- a/tests/php/ORM/Search/SearchContextTest.php +++ b/tests/php/ORM/Search/SearchContextTest.php @@ -18,7 +18,7 @@ use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Search\SearchContext; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; class SearchContextTest extends SapphireTest { diff --git a/tests/php/Security/GroupTest.php b/tests/php/Security/GroupTest.php index b4b0af7c852..1834f019ed8 100644 --- a/tests/php/Security/GroupTest.php +++ b/tests/php/Security/GroupTest.php @@ -6,7 +6,7 @@ use SilverStripe\Control\Controller; use SilverStripe\Dev\FunctionalTest; use SilverStripe\Forms\RequiredFields; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\Security\Group; use SilverStripe\Security\Member; diff --git a/tests/php/Security/MemberAuthenticatorTest.php b/tests/php/Security/MemberAuthenticatorTest.php index 53db67188cb..53f80458716 100644 --- a/tests/php/Security/MemberAuthenticatorTest.php +++ b/tests/php/Security/MemberAuthenticatorTest.php @@ -8,7 +8,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\IdentityStore; diff --git a/tests/php/Security/MemberTest.php b/tests/php/Security/MemberTest.php index ebe5c03759e..73e502a62a7 100644 --- a/tests/php/Security/MemberTest.php +++ b/tests/php/Security/MemberTest.php @@ -17,9 +17,9 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\Map; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Model\List\Map; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Group; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\Member; diff --git a/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php b/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php index 3fe1e2f3f21..67a8d4040d1 100644 --- a/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php +++ b/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Core\Extension; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Extension that does something extra when changing a member's password diff --git a/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php b/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php index fbb4c727b66..28c66b5de87 100644 --- a/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php +++ b/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php @@ -3,7 +3,7 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\PasswordValidator; class VerySpecificPasswordValidator extends PasswordValidator implements TestOnly diff --git a/tests/php/Security/PasswordExpirationMiddlewareTest.php b/tests/php/Security/PasswordExpirationMiddlewareTest.php index 6d49a495b7b..b4372b02b25 100644 --- a/tests/php/Security/PasswordExpirationMiddlewareTest.php +++ b/tests/php/Security/PasswordExpirationMiddlewareTest.php @@ -5,7 +5,7 @@ use SilverStripe\Control\Director; use SilverStripe\Control\Tests\HttpRequestMockBuilder; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\PasswordExpirationMiddleware; use SilverStripe\Security\Member; use SilverStripe\Security\Security; diff --git a/tests/php/Security/SecurityTest.php b/tests/php/Security/SecurityTest.php index bad715f7b7b..44573e00b52 100644 --- a/tests/php/Security/SecurityTest.php +++ b/tests/php/Security/SecurityTest.php @@ -18,7 +18,7 @@ use SilverStripe\ORM\FieldType\DBEnum; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\LoginAttempt; use SilverStripe\Security\Member; use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator; diff --git a/tests/php/Security/VersionedMemberAuthenticatorTest.php b/tests/php/Security/VersionedMemberAuthenticatorTest.php index a2693156796..a53d5de3184 100644 --- a/tests/php/Security/VersionedMemberAuthenticatorTest.php +++ b/tests/php/Security/VersionedMemberAuthenticatorTest.php @@ -8,7 +8,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\IdentityStore; diff --git a/tests/php/View/RequirementsTest.php b/tests/php/View/RequirementsTest.php index 30838d4eba9..7c900a1eb66 100644 --- a/tests/php/View/RequirementsTest.php +++ b/tests/php/View/RequirementsTest.php @@ -8,7 +8,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\i18n\i18n; use SilverStripe\View\Requirements; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use Silverstripe\Assets\Dev\TestAssetStore; use SilverStripe\View\Requirements_Backend; use SilverStripe\Core\Manifest\ResourceURLGenerator; diff --git a/tests/php/View/SSViewerCacheBlockTest.php b/tests/php/View/SSViewerCacheBlockTest.php index 09f334884df..5281b6a2578 100644 --- a/tests/php/View/SSViewerCacheBlockTest.php +++ b/tests/php/View/SSViewerCacheBlockTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\Cache\Psr16Cache; -// Not actually a data object, we just want a ViewableData object that's just for us +// Not actually a data object, we just want a ModelData object that's just for us class SSViewerCacheBlockTest extends SapphireTest { diff --git a/tests/php/View/SSViewerTest.php b/tests/php/View/SSViewerTest.php index 45af82fbd72..112cb11eeb3 100644 --- a/tests/php/View/SSViewerTest.php +++ b/tests/php/View/SSViewerTest.php @@ -15,14 +15,14 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\SapphireTest; use SilverStripe\i18n\i18n; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\PaginatedList; +use SilverStripe\Model\List\PaginatedList; use SilverStripe\Security\Permission; use SilverStripe\Security\Security; use SilverStripe\Security\SecurityToken; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\ArrayData; use SilverStripe\View\Requirements; use SilverStripe\View\Requirements_Backend; use SilverStripe\View\SSTemplateParseException; @@ -31,8 +31,8 @@ use SilverStripe\View\SSViewer_FromString; use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModel; use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModelController; -use SilverStripe\View\Tests\SSViewerTest\TestViewableData; -use SilverStripe\View\ViewableData; +use SilverStripe\View\Tests\SSViewerTest\TestModelData; +use SilverStripe\Model\ModelData; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; @@ -598,7 +598,7 @@ public static function provideArgumentTypes() #[DataProvider('provideArgumentTypes')] public function testArgumentTypes(string $expected, string $template) { - $this->assertEquals($expected, $this->render($template, new TestViewableData())); + $this->assertEquals($expected, $this->render($template, new TestModelData())); } public function testObjectDotArguments() @@ -767,7 +767,7 @@ public static function typePreservationDataProvider() public function testTypesArePreserved($expected, $templateArg) { $data = new ArrayData([ - 'Test' => new TestViewableData() + 'Test' => new TestModelData() ]); $this->assertEquals($expected, $this->render("\$Test.Type({$templateArg})", $data)); @@ -777,7 +777,7 @@ public function testTypesArePreserved($expected, $templateArg) public function testTypesArePreservedAsIncludeArguments($expected, $templateArg) { $data = new ArrayData([ - 'Test' => new TestViewableData() + 'Test' => new TestModelData() ]); $this->assertEquals( @@ -789,7 +789,7 @@ public function testTypesArePreservedAsIncludeArguments($expected, $templateArg) public function testTypePreservationInConditionals() { $data = new ArrayData([ - 'Test' => new TestViewableData() + 'Test' => new TestModelData() ]); // Types in conditionals @@ -1326,12 +1326,12 @@ public function assertEqualIgnoringWhitespace($a, $b, $message = '') } /** - * See {@link ViewableDataTest} for more extensive casting tests, + * See {@link ModelDataTest} for more extensive casting tests, * this test just ensures that basic casting is correctly applied during template parsing. */ public function testCastingHelpers() { - $vd = new SSViewerTest\TestViewableData(); + $vd = new SSViewerTest\TestModelData(); $vd->TextValue = 'html'; $vd->HTMLValue = 'html'; $vd->UncastedValue = 'html'; @@ -1364,8 +1364,8 @@ public function testCastingHelpers() $t = SSViewer::fromString('$HTMLValue.XML')->process($vd) ); - // Uncasted value (falls back to ViewableData::$default_cast="Text") - $vd = new SSViewerTest\TestViewableData(); + // Uncasted value (falls back to ModelData::$default_cast="Text") + $vd = new SSViewerTest\TestModelData(); $vd->UncastedValue = 'html'; $this->assertEquals( '<b>html</b>', @@ -1974,7 +1974,7 @@ public function testRewriteHashlinks() ' ); $tmpl = new SSViewer($tmplFile); - $obj = new ViewableData(); + $obj = new ModelData(); $obj->InsertedLink = DBField::create_field( 'HTMLFragment', 'InsertedLink' @@ -2029,7 +2029,7 @@ public function testRewriteHashlinksInPhpMode() ' ); $tmpl = new SSViewer($tmplFile); - $obj = new ViewableData(); + $obj = new ModelData(); $obj->InsertedLink = DBField::create_field( 'HTMLFragment', 'InsertedLink' @@ -2171,13 +2171,13 @@ public function testProcessOnlyIncludesRequirementsOnce() Requirements::set_backend($backend); - $this->assertEquals(1, substr_count($template->process(new ViewableData()) ?? '', "a.css")); - $this->assertEquals(1, substr_count($template->process(new ViewableData()) ?? '', "b.css")); + $this->assertEquals(1, substr_count($template->process(new ModelData()) ?? '', "a.css")); + $this->assertEquals(1, substr_count($template->process(new ModelData()) ?? '', "b.css")); // if we disable the requirements then we should get nothing $template->includeRequirements(false); - $this->assertEquals(0, substr_count($template->process(new ViewableData()) ?? '', "a.css")); - $this->assertEquals(0, substr_count($template->process(new ViewableData()) ?? '', "b.css")); + $this->assertEquals(0, substr_count($template->process(new ModelData()) ?? '', "a.css")); + $this->assertEquals(0, substr_count($template->process(new ModelData()) ?? '', "b.css")); } public function testRequireCallInTemplateInclude() @@ -2190,7 +2190,7 @@ public function testRequireCallInTemplateInclude() $this->assertEquals( 1, substr_count( - $template->process(new ViewableData()) ?? '', + $template->process(new ModelData()) ?? '', "tests/php/View/SSViewerTest/javascript/RequirementsTest_a.js" ) ); diff --git a/tests/php/View/SSViewerTest/CacheTestData.php b/tests/php/View/SSViewerTest/CacheTestData.php index 8f793a53cfb..3be03ae74b2 100644 --- a/tests/php/View/SSViewerTest/CacheTestData.php +++ b/tests/php/View/SSViewerTest/CacheTestData.php @@ -3,11 +3,11 @@ namespace SilverStripe\View\Tests\SSViewerTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; +use SilverStripe\Model\ModelData; -class CacheTestData extends ViewableData implements TestOnly +class CacheTestData extends ModelData implements TestOnly { public $testWithCalls = 0; diff --git a/tests/php/View/SSViewerTest/LevelTestData.php b/tests/php/View/SSViewerTest/LevelTestData.php index 017d47e74e8..020076812b4 100644 --- a/tests/php/View/SSViewerTest/LevelTestData.php +++ b/tests/php/View/SSViewerTest/LevelTestData.php @@ -3,10 +3,10 @@ namespace SilverStripe\View\Tests\SSViewerTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ModelData; -class LevelTestData extends ViewableData implements TestOnly +class LevelTestData extends ModelData implements TestOnly { protected $depth; diff --git a/tests/php/View/SSViewerTest/TestFixture.php b/tests/php/View/SSViewerTest/TestFixture.php index d294517138c..f0abb39bc69 100644 --- a/tests/php/View/SSViewerTest/TestFixture.php +++ b/tests/php/View/SSViewerTest/TestFixture.php @@ -2,13 +2,13 @@ namespace SilverStripe\View\Tests\SSViewerTest; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ModelData; /** * A test fixture that will echo back the template item */ -class TestFixture extends ViewableData +class TestFixture extends ModelData { protected $name; @@ -45,7 +45,7 @@ public function obj( return $output; } else { if (preg_match('/NotSet/i', $fieldName ?? '')) { - return new ViewableData(); + return new ModelData(); } else { return new TestFixture($childName); } diff --git a/tests/php/View/SSViewerTest/TestViewableData.php b/tests/php/View/SSViewerTest/TestViewableData.php index 9817666bdbd..febbbe9b460 100644 --- a/tests/php/View/SSViewerTest/TestViewableData.php +++ b/tests/php/View/SSViewerTest/TestViewableData.php @@ -3,13 +3,13 @@ namespace SilverStripe\View\Tests\SSViewerTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * @property string $TextValue * @property string $HTMLValue */ -class TestViewableData extends ViewableData implements TestOnly +class TestModelData extends ModelData implements TestOnly { private static $default_cast = 'Text'; diff --git a/tests/php/View/ViewableDataCustomisedTest.php b/tests/php/View/ViewableDataCustomisedTest.php deleted file mode 100644 index df60323bac0..00000000000 --- a/tests/php/View/ViewableDataCustomisedTest.php +++ /dev/null @@ -1,55 +0,0 @@ -makeOuterOriginal(), $this->makeInnerViewableDataCustomised()); - $this->assertThat($outerCustomised, $this->makeTestConstraint()); - } - - public function testNestedViewableDataCustomisedAsOriginal() - { - $outerCustomised = ViewableData_Customised::create($this->makeInnerViewableDataCustomised(), $this->makeOuterOriginal()); - $this->assertThat($outerCustomised, $this->makeTestConstraint()); - } - - private function makeTestConstraint() - { - return new ViewableDataContains([ - 'outerOriginal' => 'foobar', - 'innerOriginal' => 'hello', - 'innerCustomised' => 'world', - ]); - } - - private function makeOuterOriginal() - { - return ArrayData::create([ - 'outerOriginal' => 'foobar', - ]); - } - - private function makeInnerViewableDataCustomised() - { - $original = ArrayData::create([ - 'innerOriginal' => 'hello', - ]); - - $customised = ArrayData::create([ - 'innerCustomised' => 'world', - ]); - - return ViewableData_Customised::create($original, $customised); - } -} diff --git a/tests/php/View/ViewableDataTest/Cached.php b/tests/php/View/ViewableDataTest/Cached.php deleted file mode 100644 index 84ccd21eccb..00000000000 --- a/tests/php/View/ViewableDataTest/Cached.php +++ /dev/null @@ -1,11 +0,0 @@ -