API Move various classes to more appropriate namespaces (#11370)

Also rename ViewableData to ModelData ahead of the template layer
lift-and-shift
This commit is contained in:
Guy Sartorelli 2024-09-23 14:31:50 +12:00 committed by GitHub
parent 7793664efe
commit e2e32317d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
267 changed files with 971 additions and 957 deletions

View File

@ -96,6 +96,8 @@
"SilverStripe\\i18n\\Tests\\": "tests/php/i18n/", "SilverStripe\\i18n\\Tests\\": "tests/php/i18n/",
"SilverStripe\\Logging\\": "src/Logging/", "SilverStripe\\Logging\\": "src/Logging/",
"SilverStripe\\Logging\\Tests\\": "tests/php/Logging/", "SilverStripe\\Logging\\Tests\\": "tests/php/Logging/",
"SilverStripe\\Model\\": "src/Model/",
"SilverStripe\\Model\\Tests\\": "tests/php/Model/",
"SilverStripe\\ORM\\": "src/ORM/", "SilverStripe\\ORM\\": "src/ORM/",
"SilverStripe\\ORM\\Tests\\": "tests/php/ORM/", "SilverStripe\\ORM\\Tests\\": "tests/php/ORM/",
"SilverStripe\\Security\\": "src/Security/", "SilverStripe\\Security\\": "src/Security/",

View File

@ -230,7 +230,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider
} }
$this->setResponse($response); $this->setResponse($response);
} else { } else {
// Could be Controller, or ViewableData_Customised controller wrapper // Could be Controller, or ModelDataCustomised controller wrapper
if (ClassInfo::hasMethod($response, 'getViewer')) { if (ClassInfo::hasMethod($response, 'getViewer')) {
if (isset($_REQUEST['debug_request'])) { if (isset($_REQUEST['debug_request'])) {
$class = static::class; $class = static::class;

View File

@ -13,11 +13,11 @@ use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ThemeResourceLoader; use SilverStripe\View\ThemeResourceLoader;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email as SymfonyEmail; use Symfony\Component\Mime\Email as SymfonyEmail;
@ -56,9 +56,9 @@ class Email extends SymfonyEmail
/** /**
* Additional data available in a template. * 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; private bool $dataHasBeenSet = false;
@ -194,7 +194,7 @@ class Email extends SymfonyEmail
if ($returnPath) { if ($returnPath) {
$this->setReturnPath($returnPath); $this->setReturnPath($returnPath);
} }
$this->data = ViewableData::create(); $this->data = ModelData::create();
} }
private function getDefaultFrom(): string|array private function getDefaultFrom(): string|array
@ -336,7 +336,7 @@ class Email extends SymfonyEmail
* IsEmail: used to detect if rendering an email template rather than a page template * IsEmail: used to detect if rendering an email template rather than a page template
* BaseUrl: used to get the base URL for the email * BaseUrl: used to get the base URL for the email
*/ */
public function getData(): ViewableData public function getData(): ModelData
{ {
$extraData = [ $extraData = [
'IsEmail' => true, 'IsEmail' => true,
@ -357,7 +357,7 @@ class Email extends SymfonyEmail
* *
* Calling setData() once means that any content set via text()/html()/setBody() will have no effect * 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)) { if (is_array($data)) {
$data = ArrayData::create($data); $data = ArrayData::create($data);

View File

@ -6,7 +6,7 @@ use ArrayAccess;
use BadMethodCallException; use BadMethodCallException;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Core\ClassInfo; 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 * Represents a HTTP-request, including a URL that is tokenised for parsing, and a request method

View File

@ -3,8 +3,8 @@
namespace SilverStripe\Control\RSS; namespace SilverStripe\Control\RSS;
use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware; use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Control\Director; use SilverStripe\Control\Director;
@ -12,14 +12,14 @@ use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTP; use SilverStripe\Control\HTTP;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* RSSFeed class * RSSFeed class
* *
* This class is used to create an RSS feed. * This class is used to create an RSS feed.
*/ */
class RSSFeed extends ViewableData class RSSFeed extends ModelData
{ {
/** /**

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Control\RSS;
use SilverStripe\Control\Director; use SilverStripe\Control\Director;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use BadMethodCallException; use BadMethodCallException;
/** /**
@ -15,7 +15,7 @@ use BadMethodCallException;
* *
* @see RSSFeed * @see RSSFeed
*/ */
class RSSFeed_Entry extends ViewableData class RSSFeed_Entry extends ModelData
{ {
/** /**
* Name of the title field of feed entries * Name of the title field of feed entries
@ -40,7 +40,7 @@ class RSSFeed_Entry extends ViewableData
/** /**
* Create a new RSSFeed entry. * Create a new RSSFeed entry.
* @param ViewableData $entry * @param ModelData $entry
* @param string $titleField * @param string $titleField
* @param string $descriptionField * @param string $descriptionField
* @param string $authorField * @param string $authorField

View File

@ -13,7 +13,7 @@ use SilverStripe\Dev\Debug;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\PermissionFailureException; use SilverStripe\Security\PermissionFailureException;
use SilverStripe\Security\Security; 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. * This class is the base class of any SilverStripe object that can be used to handle HTTP requests.
@ -45,7 +45,7 @@ use SilverStripe\View\ViewableData;
* *
* {@link RequestHandler::handleRequest()} is where this behaviour is implemented. * {@link RequestHandler::handleRequest()} is where this behaviour is implemented.
*/ */
class RequestHandler extends ViewableData class RequestHandler extends ModelData
{ {
/** /**
@ -130,7 +130,7 @@ class RequestHandler extends ViewableData
/** /**
* Handles URL requests. * 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 the rule matches, the named method will be called.
* - If there is still more URL to be processed, then handleRequest() * - If there is still more URL to be processed, then handleRequest()
* is called on the object that that method returns. * is called on the object that that method returns.
@ -248,8 +248,8 @@ class RequestHandler extends ViewableData
{ {
$handlerClass = static::class; $handlerClass = static::class;
// We stop after RequestHandler; in other words, at ViewableData // We stop after RequestHandler; in other words, at ModelData
while ($handlerClass && $handlerClass != ViewableData::class) { while ($handlerClass && $handlerClass != ModelData::class) {
$urlHandlers = Config::inst()->get($handlerClass, 'url_handlers', Config::UNINHERITED); $urlHandlers = Config::inst()->get($handlerClass, 'url_handlers', Config::UNINHERITED);
if ($urlHandlers) { if ($urlHandlers) {

View File

@ -1,24 +1,15 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Core;
use Generator; use Generator;
use SilverStripe\Dev\Deprecation;
use InvalidArgumentException; use InvalidArgumentException;
/** /**
* Library of static methods for manipulating arrays. * Library of static methods for manipulating arrays.
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib
*/ */
class ArrayLib class ArrayLib
{ {
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib', Deprecation::SCOPE_CLASS);
});
}
/** /**
* Inverses the first and second level keys of an associative * Inverses the first and second level keys of an associative
* array, keying the result by the second level, and combines * array, keying the result by the second level, and combines
@ -54,14 +45,9 @@ class ArrayLib
* *
* @param array $arr * @param array $arr
* @return array * @return array
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::invert()
*/ */
public static function invert($arr) public static function invert($arr)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::invert()');
});
if (!$arr) { if (!$arr) {
return []; return [];
} }
@ -82,14 +68,9 @@ class ArrayLib
* *
* @param $arr array * @param $arr array
* @return array * @return array
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::valuekey()
*/ */
public static function valuekey($arr) public static function valuekey($arr)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::valuekey()');
});
return array_combine($arr ?? [], $arr ?? []); return array_combine($arr ?? [], $arr ?? []);
} }
@ -98,14 +79,9 @@ class ArrayLib
* *
* @param array $array * @param array $array
* @return array * @return array
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::array_values_recursive()
*/ */
public static function array_values_recursive($array) public static function array_values_recursive($array)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::invearray_values_recursivert()');
});
return ArrayLib::flatten($array, false); return ArrayLib::flatten($array, false);
} }
@ -117,14 +93,9 @@ class ArrayLib
* @param $keys array * @param $keys array
* *
* @return array * @return array
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::filter_keys()
*/ */
public static function filter_keys($arr, $keys) public static function filter_keys($arr, $keys)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::filter_keys()');
});
foreach ($arr as $key => $v) { foreach ($arr as $key => $v) {
if (!in_array($key, $keys ?? [])) { if (!in_array($key, $keys ?? [])) {
unset($arr[$key]); unset($arr[$key]);
@ -143,14 +114,9 @@ class ArrayLib
* @param array $array * @param array $array
* *
* @return boolean * @return boolean
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::is_associative()
*/ */
public static function is_associative($array) 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) $isAssociative = !empty($array)
&& is_array($array) && is_array($array)
&& ($array !== array_values($array ?? [])); && ($array !== array_values($array ?? []));
@ -169,14 +135,9 @@ class ArrayLib
* @param boolean $strict * @param boolean $strict
* *
* @return boolean * @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) 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)) { if (!is_array($haystack)) {
return false; return false;
} }
@ -202,14 +163,9 @@ class ArrayLib
* @param $f callback to apply * @param $f callback to apply
* @param $array array * @param $array array
* @return 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) 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) { $applyOrRecurse = function ($v) use ($f) {
return is_array($v) ? ArrayLib::array_map_recursive($f, $v) : call_user_func($f, $v); return is_array($v) ? ArrayLib::array_map_recursive($f, $v) : call_user_func($f, $v);
}; };
@ -228,14 +184,9 @@ class ArrayLib
* @param array $array * @param array $array
* *
* @return array * @return array
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::array_merge_recursive()
*/ */
public static function array_merge_recursive($array) 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(); $arrays = func_get_args();
$merged = []; $merged = [];
@ -248,7 +199,7 @@ class ArrayLib
if (!is_array($array)) { if (!is_array($array)) {
trigger_error( 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 E_USER_WARNING
); );
return []; return [];
@ -278,14 +229,9 @@ class ArrayLib
* @param array $out * @param array $out
* *
* @return array * @return array
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::flatten()
*/ */
public static function flatten($array, $preserveKeys = true, &$out = []) 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_walk_recursive(
$array, $array,
function ($value, $key) use (&$out, $preserveKeys) { function ($value, $key) use (&$out, $preserveKeys) {
@ -310,14 +256,9 @@ class ArrayLib
* *
* @param array $list * @param array $list
* @return Generator * @return Generator
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::iterateVolatile()
*/ */
public static function iterateVolatile(array &$list) 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 // Keyed by already-iterated items
$iterated = []; $iterated = [];
// Get all items not yet iterated // Get all items not yet iterated
@ -337,14 +278,9 @@ class ArrayLib
/** /**
* Similar to shuffle, but retains the existing association between the keys and the values. * Similar to shuffle, but retains the existing association between the keys and the values.
* Shuffles the array in place. * Shuffles the array in place.
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\ArrayLib::shuffleAssociative()
*/ */
public static function shuffleAssociative(array &$array): void public static function shuffleAssociative(array &$array): void
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\ArrayLib::shuffleAssociative()');
});
$shuffledArray = []; $shuffledArray = [];
$keys = array_keys($array); $keys = array_keys($array);
shuffle($keys); shuffle($keys);

View File

@ -9,7 +9,7 @@ use SilverStripe\Control\Director;
use SilverStripe\Core\Manifest\ClassLoader; use SilverStripe\Core\Manifest\ClassLoader;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use Psr\SimpleCache\CacheInterface; use Psr\SimpleCache\CacheInterface;
use SilverStripe\Core\Flushable; use SilverStripe\Core\Flushable;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
@ -585,7 +585,7 @@ class ClassInfo implements Flushable
// only keep classes with the Extension applied // only keep classes with the Extension applied
$classes = array_filter($classes ?? [], function ($class) use ($extensionClass) { $classes = array_filter($classes ?? [], function ($class) use ($extensionClass) {
return ViewableData::has_extension($class, $extensionClass); return ModelData::has_extension($class, $extensionClass);
}); });
return $classes; return $classes;

View File

@ -21,7 +21,7 @@ use SilverStripe\View\Parsers\URLSegmentFilter;
* html: HTML source suitable for use in a page or email * 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. * 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}. * which determines if they are automatically escaped before output by {@link SSViewer}.
*/ */
class Convert class Convert

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Core;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Allows an object to have extensions applied to it. * Allows an object to have extensions applied to it.
@ -43,7 +43,7 @@ trait Extensible
* @var array * @var array
*/ */
private static $unextendable_classes = [ private static $unextendable_classes = [
ViewableData::class, ModelData::class,
]; ];
/** /**

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Core\Validation; namespace SilverStripe\Core\Validation;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintViolationInterface; use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Validation;

View File

@ -1,18 +1,15 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Core\Validation;
use Exception; use Exception;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Dev\Deprecation;
/** /**
* Exception thrown by {@link DataObject}::write if validation fails. By throwing an * Exception thrown by {@link DataObject}::write if validation fails. By throwing an
* exception rather than a user error, the exception can be caught in unit tests and as such * exception rather than a user error, the exception can be caught in unit tests and as such
* can be used as a successful test. * can be used as a successful test.
*
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\Validation\ValidationException
*/ */
class ValidationException extends Exception class ValidationException extends Exception
{ {
@ -34,10 +31,6 @@ class ValidationException extends Exception
*/ */
public function __construct($result = null, $code = 0) public function __construct($result = null, $code = 0)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\Validation\ValidationException', Deprecation::SCOPE_CLASS);
});
// Catch legacy behaviour where second argument was not code // Catch legacy behaviour where second argument was not code
if ($code && !is_numeric($code)) { if ($code && !is_numeric($code)) {
throw new InvalidArgumentException("Code must be numeric"); throw new InvalidArgumentException("Code must be numeric");

View File

@ -1,10 +1,9 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Core\Validation;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Dev\Deprecation;
/** /**
* A class that combined as a boolean result with an optional list of error messages. * A class that combined as a boolean result with an optional list of error messages.
@ -12,8 +11,6 @@ use SilverStripe\Dev\Deprecation;
* *
* Each message can have a code or field which will uniquely identify that message. However, * Each message can have a code or field which will uniquely identify that message. However,
* messages can be stored without a field or message as an "overall" message. * messages can be stored without a field or message as an "overall" message.
*
* @deprecated 5.4.0 Will be renamed to SilverStripe\Core\Validation\ValidationResult
*/ */
class ValidationResult class ValidationResult
{ {
@ -64,13 +61,6 @@ class ValidationResult
*/ */
protected $messages = []; protected $messages = [];
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Core\Validation\ValidationResult', Deprecation::SCOPE_CLASS);
});
}
/** /**
* Record an error against this validation result, * Record an error against this validation result,
* *

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Dev;
use SilverStripe\Control\HTTPResponse_Exception; use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Core\Environment; use SilverStripe\Core\Environment;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* A base for bulk loaders of content into the SilverStripe database. * A base for bulk loaders of content into the SilverStripe database.
@ -16,7 +16,7 @@ use SilverStripe\View\ViewableData;
* @see http://tools.ietf.org/html/rfc4180 * @see http://tools.ietf.org/html/rfc4180
* @author Ingo Schommer, Silverstripe Ltd. (<firstname>@silverstripe.com) * @author Ingo Schommer, Silverstripe Ltd. (<firstname>@silverstripe.com)
*/ */
abstract class BulkLoader extends ViewableData abstract class BulkLoader extends ModelData
{ {
private bool $checkPermissions = false; private bool $checkPermissions = false;

View File

@ -3,9 +3,9 @@
namespace SilverStripe\Dev; namespace SilverStripe\Dev;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Encapsulates the result of a {@link BulkLoader} import * Encapsulates the result of a {@link BulkLoader} import

View File

@ -5,14 +5,14 @@ namespace SilverStripe\Dev\Constraint;
use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\Constraint\Constraint;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use SilverStripe\Dev\SapphireTest; 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. * key-value pairs.
*/ */
class ViewableDataContains extends Constraint implements TestOnly class ModelDataContains extends Constraint implements TestOnly
{ {
/** /**
* @var array * @var array
@ -20,7 +20,7 @@ class ViewableDataContains extends Constraint implements TestOnly
private $match; private $match;
/** /**
* ViewableDataContains constructor. * ModelDataContains constructor.
*/ */
public function __construct(array $match) public function __construct(array $match)
{ {
@ -44,7 +44,7 @@ class ViewableDataContains extends Constraint implements TestOnly
* a boolean value instead: true in case of success, false in case of a * a boolean value instead: true in case of success, false in case of a
* failure. * 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 string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception * @param bool $returnResult Whether to return a result or throw an exception
* *

View File

@ -5,8 +5,8 @@ namespace SilverStripe\Dev\Constraint;
use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\Constraint\Constraint;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Constraint for checking if a SS_List contains items matching the given * Constraint for checking if a SS_List contains items matching the given
@ -72,11 +72,11 @@ class SSListContains extends Constraint implements TestOnly
return null; return null;
} }
protected function checkIfItemEvaluatesRemainingMatches(ViewableData $item): bool protected function checkIfItemEvaluatesRemainingMatches(ModelData $item): bool
{ {
$success = false; $success = false;
foreach ($this->matches as $key => $match) { foreach ($this->matches as $key => $match) {
$constraint = new ViewableDataContains($match); $constraint = new ModelDataContains($match);
if ($constraint->evaluate($item, '', true)) { if ($constraint->evaluate($item, '', true)) {
$success = true; $success = true;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Dev\Constraint;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use SilverStripe\Dev\TestOnly; 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 * Constraint for checking if a SS_List contains only items matching the given

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Dev\Constraint;
use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\Constraint\Constraint;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use SilverStripe\Dev\TestOnly; 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, * 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; private $match;
/** /**
* @var ViewableDataContains * @var ModelDataContains
*/ */
private $constraint; private $constraint;
public function __construct($match) public function __construct($match)
{ {
$this->constraint = new ViewableDataContains($match); $this->constraint = new ModelDataContains($match);
$this->match = $match; $this->match = $match;
} }

View File

@ -33,7 +33,7 @@ use SilverStripe\i18n\i18n;
use SilverStripe\ORM\Connect\TempDatabase; use SilverStripe\ORM\Connect\TempDatabase;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\Security\Group; use SilverStripe\Security\Group;
use SilverStripe\Security\IdentityStore; use SilverStripe\Security\IdentityStore;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;

View File

@ -11,12 +11,12 @@ use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Manifest\ModuleResourceLoader; use SilverStripe\Core\Manifest\ModuleResourceLoader;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\PermissionProvider; use SilverStripe\Security\PermissionProvider;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class TaskRunner extends Controller implements PermissionProvider class TaskRunner extends Controller implements PermissionProvider
{ {
@ -92,7 +92,7 @@ class TaskRunner extends Controller implements PermissionProvider
'Info' => $renderer->renderInfo('SilverStripe Development Tools: Tasks', $baseUrl), 'Info' => $renderer->renderInfo('SilverStripe Development Tools: Tasks', $baseUrl),
]; ];
return ViewableData::create()->renderWith(static::class, $data); return ModelData::create()->renderWith(static::class, $data);
} }
/** /**

View File

@ -3,10 +3,10 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Displays a set of checkboxes as a logical group. * Displays a set of checkboxes as a logical group.

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use InvalidArgumentException; 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 * CompositeValidator can contain between 0 and many different types of Validators. Each Validator is itself still

View File

@ -7,7 +7,7 @@ use SilverStripe\i18n\i18n;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\ORM\FieldType\DBDate; use SilverStripe\ORM\FieldType\DBDate;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
/** /**
* Form used for editing a date string * Form used for editing a date string

View File

@ -7,7 +7,7 @@ use InvalidArgumentException;
use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18n;
use SilverStripe\ORM\FieldType\DBDate; use SilverStripe\ORM\FieldType\DBDate;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
/** /**
* Form field used for editing date time strings. * Form field used for editing date time strings.

View File

@ -2,8 +2,8 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Dropdown field, created from a select tag. * Dropdown field, created from a select tag.

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
/** /**
* Lets you include a nested group of fields inside a template. * Lets you include a nested group of fields inside a template.

View File

@ -6,7 +6,7 @@ use InvalidArgumentException;
use RuntimeException; use RuntimeException;
use SilverStripe\Forms\Tab; use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TabSet; use SilverStripe\Forms\TabSet;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\Deprecation;
/** /**

View File

@ -7,13 +7,13 @@ use InvalidArgumentException;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
use SilverStripe\Assets\Storage\AssetContainer; use SilverStripe\Assets\Storage\AssetContainer;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\RelationList; use SilverStripe\ORM\RelationList;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\UnsavedRelationList; use SilverStripe\ORM\UnsavedRelationList;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
/** /**
* Provides operations for reading and writing uploaded files to/from * Provides operations for reading and writing uploaded files to/from

View File

@ -14,12 +14,12 @@ use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\NullSecurityToken; use SilverStripe\Security\NullSecurityToken;
use SilverStripe\Security\SecurityToken; use SilverStripe\Security\SecurityToken;
use SilverStripe\View\AttributesHTML; use SilverStripe\View\AttributesHTML;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Base class for all forms. * Base class for all forms.
@ -62,7 +62,7 @@ use SilverStripe\View\ViewableData;
* For example, the "URLSegment" field in a standard CMS form would be * For example, the "URLSegment" field in a standard CMS form would be
* accessible through "admin/EditForm/field/URLSegment/FieldHolder". * accessible through "admin/EditForm/field/URLSegment/FieldHolder".
*/ */
class Form extends ViewableData implements HasRequestHandler class Form extends ModelData implements HasRequestHandler
{ {
use AttributesHTML; use AttributesHTML;
use FormMessage; use FormMessage;
@ -135,7 +135,7 @@ class Form extends ViewableData implements HasRequestHandler
/** /**
* Populated by {@link loadDataFrom()}. * Populated by {@link loadDataFrom()}.
* *
* @var ViewableData|null * @var ModelData|null
*/ */
protected $record; protected $record;
@ -1225,7 +1225,7 @@ class Form extends ViewableData implements HasRequestHandler
* Returns the record that has given this form its data * Returns the record that has given this form its data
* through {@link loadDataFrom()}. * through {@link loadDataFrom()}.
* *
* @return ViewableData * @return ModelData
*/ */
public function getRecord() public function getRecord()
{ {
@ -1305,7 +1305,7 @@ class Form extends ViewableData implements HasRequestHandler
* @uses FormField::setSubmittedValue() * @uses FormField::setSubmittedValue()
* @uses FormField::setValue() * @uses FormField::setValue()
* *
* @param array|ViewableData $data * @param array|ModelData $data
* @param int $mergeStrategy * @param int $mergeStrategy
* For every field, {@link $data} is interrogated whether it contains a relevant property/key, and * For every field, {@link $data} is interrogated whether it contains a relevant property/key, and
* what that property/key's value is. * what that property/key's value is.
@ -1402,7 +1402,7 @@ class Form extends ViewableData implements HasRequestHandler
// There's no other way to tell whether the relation actually exists // There's no other way to tell whether the relation actually exists
$exists = false; $exists = false;
} }
// Regular ViewableData access // Regular ModelData access
} else { } else {
$exists = ( $exists = (
isset($data->$name) || isset($data->$name) ||
@ -1478,7 +1478,7 @@ class Form extends ViewableData implements HasRequestHandler
* Save the contents of this form into the given data object. * Save the contents of this form into the given data object.
* It will make use of setCastedField() to do this. * 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<string>|null $fieldList An optional list of fields to process. This can be useful when you have a * @param array<string>|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. * form that has some fields that save to one object, and some that save to another.
*/ */

View File

@ -11,10 +11,10 @@ use SilverStripe\Core\Convert;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\View\AttributesHTML; use SilverStripe\View\AttributesHTML;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a field in a form. * Represents a field in a form.
@ -325,7 +325,7 @@ class FormField extends RequestHandler
* Creates a new field. * Creates a new field.
* *
* @param string $name The internal field name, passed to forms. * @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. * @param mixed $value The value of the field.
*/ */
public function __construct($name, $title = null, $value = null) public function __construct($name, $title = null, $value = null)
@ -458,7 +458,7 @@ class FormField extends RequestHandler
* *
* By default, makes use of $this->dataValue() * 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) public function saveInto(DataObjectInterface $record)
{ {
@ -697,7 +697,7 @@ class FormField extends RequestHandler
* or a submitted form value they should override setSubmittedValue() instead. * 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 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 * @return $this
*/ */
public function setValue($value, $data = null) public function setValue($value, $data = null)
@ -712,7 +712,7 @@ class FormField extends RequestHandler
* data formats. * data formats.
* *
* @param mixed $value * @param mixed $value
* @param array|ViewableData $data * @param array|ModelData $data
* @return $this * @return $this
*/ */
public function setSubmittedValue($value, $data = null) public function setSubmittedValue($value, $data = null)

View File

@ -3,13 +3,13 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Form component which contains a castable message * Form component which contains a castable message
* *
* @mixin ViewableData * @mixin ModelData
*/ */
trait FormMessage trait FormMessage
{ {

View File

@ -11,9 +11,9 @@ use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Control\RequestHandler; use SilverStripe\Control\RequestHandler;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
class FormRequestHandler extends RequestHandler class FormRequestHandler extends RequestHandler
{ {

View File

@ -2,9 +2,9 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class Form_FieldMap extends ViewableData class Form_FieldMap extends ModelData
{ {
/** /**

View File

@ -18,16 +18,16 @@ use SilverStripe\Forms\Form;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\Forms\GridField\FormAction\SessionStore; use SilverStripe\Forms\GridField\FormAction\SessionStore;
use SilverStripe\Forms\GridField\FormAction\StateStore; use SilverStripe\Forms\GridField\FormAction\StateStore;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\Filterable; use SilverStripe\Model\List\Filterable;
use SilverStripe\ORM\Limitable; use SilverStripe\Model\List\Limitable;
use SilverStripe\ORM\Sortable; use SilverStripe\Model\List\Sortable;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\View\HTML; use SilverStripe\View\HTML;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Displays a {@link SS_List} in a grid format. * Displays a {@link SS_List} in a grid format.
@ -767,7 +767,7 @@ class GridField extends FormField
/** /**
* @param int $total * @param int $total
* @param int $index * @param int $index
* @param ViewableData $record * @param ModelData $record
* @param array $attributes * @param array $attributes
* @param string $content * @param string $content
* *
@ -785,7 +785,7 @@ class GridField extends FormField
/** /**
* @param int $total * @param int $total
* @param int $index * @param int $index
* @param ViewableData $record * @param ModelData $record
* @param array $attributes * @param array $attributes
* @param string $content * @param string $content
* *
@ -803,7 +803,7 @@ class GridField extends FormField
/** /**
* @param int $total * @param int $total
* @param int $index * @param int $index
* @param ViewableData $record * @param ModelData $record
* *
* @return array * @return array
*/ */
@ -821,7 +821,7 @@ class GridField extends FormField
/** /**
* @param int $total * @param int $total
* @param int $index * @param int $index
* @param ViewableData $record * @param ModelData $record
* *
* @return array * @return array
*/ */
@ -892,7 +892,7 @@ class GridField extends FormField
/** /**
* Get the value from a column. * Get the value from a column.
* *
* @param ViewableData $record * @param ModelData $record
* @param string $column * @param string $column
* *
* @return string * @return string
@ -945,7 +945,7 @@ class GridField extends FormField
* Use of this method ensures that any special rules around the data for this gridfield are * Use of this method ensures that any special rules around the data for this gridfield are
* followed. * followed.
* *
* @param ViewableData $record * @param ModelData $record
* @param string $fieldName * @param string $fieldName
* *
* @return mixed * @return mixed
@ -972,7 +972,7 @@ class GridField extends FormField
/** /**
* Get extra columns attributes used as HTML attributes. * Get extra columns attributes used as HTML attributes.
* *
* @param ViewableData $record * @param ModelData $record
* @param string $column * @param string $column
* *
* @return array * @return array

View File

@ -9,11 +9,11 @@ use SilverStripe\Core\Convert;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use LogicException; use LogicException;
use SilverStripe\Control\HTTPResponse_Exception; use SilverStripe\Control\HTTPResponse_Exception;

View File

@ -7,7 +7,7 @@ use SilverStripe\Control\Controller;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\RelationList; use SilverStripe\ORM\RelationList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
/** /**

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
/** /**

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Forms\GridField;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Extensible; use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
/** /**
* Encapsulates a collection of components following the * Encapsulates a collection of components following the

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Forms\GridField;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; use LogicException;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* @see GridField * @see GridField
@ -155,7 +155,7 @@ class GridFieldDataColumns extends AbstractGridFieldComponent implements GridFie
* HTML for the column, content of the <td> element. * HTML for the column, content of the <td> element.
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record Record displayed in this row * @param ModelData $record Record displayed in this row
* @param string $columnName * @param string $columnName
* @return string HTML for the column. Return NULL to skip. * @return string HTML for the column. Return NULL to skip.
*/ */
@ -189,7 +189,7 @@ class GridFieldDataColumns extends AbstractGridFieldComponent implements GridFie
* Attributes for the element containing the content returned by {@link getColumnContent()}. * Attributes for the element containing the content returned by {@link getColumnContent()}.
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record displayed in this row * @param ModelData $record displayed in this row
* @param string $columnName * @param string $columnName
* @return array * @return array
*/ */
@ -225,7 +225,7 @@ class GridFieldDataColumns extends AbstractGridFieldComponent implements GridFie
/** /**
* Translate a Object.RelationName.ColumnName $columnName into the value that ColumnName returns * Translate a Object.RelationName.ColumnName $columnName into the value that ColumnName returns
* *
* @param ViewableData $record * @param ModelData $record
* @param string $columnName * @param string $columnName
* @return string|null - returns null if it could not found a value * @return string|null - returns null if it could not found a value
*/ */
@ -278,7 +278,7 @@ class GridFieldDataColumns extends AbstractGridFieldComponent implements GridFie
/** /**
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $item * @param ModelData $item
* @param string $fieldName * @param string $fieldName
* @param string $value * @param string $value
* @return string * @return string

View File

@ -6,8 +6,8 @@ use LogicException;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* This class is a {@link GridField} component that adds a delete action for * This class is a {@link GridField} component that adds a delete action for
@ -75,7 +75,7 @@ class GridFieldDeleteAction extends AbstractGridFieldComponent implements GridFi
/** /**
* *
* @param GridField $gridField * @param GridField $gridField
* @param DataObjectInterface&ViewableData $record * @param DataObjectInterface&ModelData $record
* @param string $columnName * @param string $columnName
* @return string|null the attribles for the action * @return string|null the attribles for the action
*/ */
@ -107,7 +107,7 @@ class GridFieldDeleteAction extends AbstractGridFieldComponent implements GridFi
* Return any special attributes that will be used for FormField::create_tag() * Return any special attributes that will be used for FormField::create_tag()
* *
* @param GridField $gridField * @param GridField $gridField
* @param DataObjectInterface&ViewableData $record * @param DataObjectInterface&ModelData $record
* @param string $columnName * @param string $columnName
* @return array * @return array
*/ */
@ -155,7 +155,7 @@ class GridFieldDeleteAction extends AbstractGridFieldComponent implements GridFi
/** /**
* *
* @param GridField $gridField * @param GridField $gridField
* @param DataObjectInterface&ViewableData $record * @param DataObjectInterface&ModelData $record
* @param string $columnName * @param string $columnName
* @return string|null the HTML for the column * @return string|null the HTML for the column
*/ */
@ -183,7 +183,7 @@ class GridFieldDeleteAction extends AbstractGridFieldComponent implements GridFi
{ {
$list = $gridField->getList(); $list = $gridField->getList();
if ($actionName == 'deleterecord' || $actionName == 'unlinkrelation') { if ($actionName == 'deleterecord' || $actionName == 'unlinkrelation') {
/** @var DataObjectInterface&ViewableData $item */ /** @var DataObjectInterface&ModelData $item */
$item = $list->byID($arguments['RecordID']); $item = $list->byID($arguments['RecordID']);
if (!$item) { if (!$item) {
return; return;
@ -221,7 +221,7 @@ class GridFieldDeleteAction extends AbstractGridFieldComponent implements GridFi
/** /**
* *
* @param GridField $gridField * @param GridField $gridField
* @param DataObjectInterface&ViewableData $record * @param DataObjectInterface&ModelData $record
* @param string $columnName * @param string $columnName
* @return GridField_FormAction|null * @return GridField_FormAction|null
*/ */

View File

@ -18,7 +18,7 @@ use SilverStripe\Forms\FieldsValidator;
use SilverStripe\Forms\Validator; use SilverStripe\Forms\Validator;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Provides view and edit forms at GridField-specific URLs. * Provides view and edit forms at GridField-specific URLs.
@ -156,9 +156,9 @@ class GridFieldDetailForm extends AbstractGridFieldComponent implements GridFiel
return $handler->handleRequest($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'))) { if (is_numeric($request->param('ID'))) {
$dataList = $gridField->getList(); $dataList = $gridField->getList();
$record = $dataList->byID($request->param('ID')); $record = $dataList->byID($request->param('ID'));
@ -219,7 +219,7 @@ class GridFieldDetailForm extends AbstractGridFieldComponent implements GridFiel
* Build a request handler for the given record * Build a request handler for the given record
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record * @param ModelData $record
* @param RequestHandler $requestHandler * @param RequestHandler $requestHandler
* @return GridFieldDetailForm_ItemRequest * @return GridFieldDetailForm_ItemRequest
*/ */

View File

@ -17,7 +17,7 @@ use SilverStripe\Forms\Form;
use SilverStripe\Forms\FormAction; use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\LiteralField;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
@ -25,13 +25,13 @@ use SilverStripe\ORM\HasManyList;
use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\PolymorphicHasManyList; use SilverStripe\ORM\PolymorphicHasManyList;
use SilverStripe\ORM\RelationList; use SilverStripe\ORM\RelationList;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\HTML; use SilverStripe\View\HTML;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class GridFieldDetailForm_ItemRequest extends RequestHandler class GridFieldDetailForm_ItemRequest extends RequestHandler
{ {
@ -68,7 +68,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
protected $component; protected $component;
/** /**
* @var ViewableData * @var ModelData
*/ */
protected $record; protected $record;
@ -100,7 +100,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
* *
* @param GridField $gridField * @param GridField $gridField
* @param GridFieldDetailForm $component * @param GridFieldDetailForm $component
* @param ViewableData&DataObjectInterface $record * @param ModelData&DataObjectInterface $record
* @param RequestHandler $requestHandler * @param RequestHandler $requestHandler
* @param string $popupFormName * @param string $popupFormName
*/ */
@ -528,7 +528,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
* Handles detection of falsey values explicitly saved into the * Handles detection of falsey values explicitly saved into the
* record by formfields * record by formfields
* *
* @param ViewableData $record * @param ModelData $record
* @param SS_List $list * @param SS_List $list
* @return array List of data to write to the relation * @return array List of data to write to the relation
*/ */
@ -785,7 +785,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
* @param array $data * @param array $data
* @param Form $form * @param Form $form
* @throws ValidationException On error * @throws ValidationException On error
* @return ViewableData&DataObjectInterface Saved record * @return ModelData&DataObjectInterface Saved record
*/ */
protected function saveFormIntoRecord($data, $form) protected function saveFormIntoRecord($data, $form)
{ {
@ -905,7 +905,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
} }
/** /**
* @return ViewableData * @return ModelData
*/ */
public function getRecord() public function getRecord()
{ {

View File

@ -3,9 +3,9 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Provides the entry point to editing a single record presented by the * Provides the entry point to editing a single record presented by the
@ -91,7 +91,7 @@ class GridFieldEditButton extends AbstractGridFieldComponent implements GridFiel
* Return any special attributes that will be used for FormField::create_tag() * Return any special attributes that will be used for FormField::create_tag()
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record * @param ModelData $record
* @param string $columnName * @param string $columnName
* @return array * @return array
*/ */
@ -139,7 +139,7 @@ class GridFieldEditButton extends AbstractGridFieldComponent implements GridFiel
/** /**
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record * @param ModelData $record
* @param string $columnName * @param string $columnName
* @return string The HTML for the column * @return string The HTML for the column
*/ */

View File

@ -8,8 +8,8 @@ use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Adds an "Export list" button to the bottom of a {@link GridField}. * Adds an "Export list" button to the bottom of a {@link GridField}.
@ -228,7 +228,7 @@ class GridFieldExportButton extends AbstractGridFieldComponent implements GridFi
? $gridFieldColumnsComponent->getColumnsHandled($gridField) ? $gridFieldColumnsComponent->getColumnsHandled($gridField)
: []; : [];
/** @var SS_List<ViewableData> $items */ /** @var SS_List<ModelData> $items */
// Remove limit as the list may be paginated, we want the full list for the export // Remove limit as the list may be paginated, we want the full list for the export
$items = $items->limit(null); $items = $items->limit(null);

View File

@ -11,10 +11,10 @@ use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\Forms\Schema\FormSchema; use SilverStripe\Forms\Schema\FormSchema;
use SilverStripe\ORM\Filterable; use SilverStripe\Model\List\Filterable;
use SilverStripe\ORM\Search\SearchContext; use SilverStripe\ORM\Search\SearchContext;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
/** /**

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
/** /**

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
class GridFieldImportButton extends AbstractGridFieldComponent implements GridField_HTMLProvider class GridFieldImportButton extends AbstractGridFieldComponent implements GridField_HTMLProvider

View File

@ -4,9 +4,9 @@ namespace SilverStripe\Forms\GridField;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\Forms\TabSet; use SilverStripe\Forms\TabSet;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\Filterable; use SilverStripe\Model\List\Filterable;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
/** /**
* GridFieldLazyLoader alters the {@link GridField} behavior to delay rendering of rows until the tab containing the * GridFieldLazyLoader alters the {@link GridField} behavior to delay rendering of rows until the tab containing the

View File

@ -6,7 +6,7 @@ use LogicException;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\Hierarchy\Hierarchy; use SilverStripe\ORM\Hierarchy\Hierarchy;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\HTML; use SilverStripe\View\HTML;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;

View File

@ -3,10 +3,10 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\ORM\Limitable; use SilverStripe\Model\List\Limitable;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\UnsavedRelationList; use SilverStripe\ORM\UnsavedRelationList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use LogicException; use LogicException;
use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\Deprecation;

View File

@ -6,13 +6,13 @@ use LogicException;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Core\Extensible; use SilverStripe\Core\Extensible;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Adds an "Print" button to the bottom or top of a GridField. * Adds an "Print" button to the bottom or top of a GridField.
@ -233,7 +233,7 @@ class GridFieldPrintButton extends AbstractGridFieldComponent implements GridFie
$gridFieldColumnsComponent = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class); $gridFieldColumnsComponent = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);
/** @var ViewableData $item */ /** @var ModelData $item */
foreach ($items->limit(null) as $item) { foreach ($items->limit(null) as $item) {
// Assume item can be viewed if canView() isn't implemented // Assume item can be viewed if canView() isn't implemented
if (!$item->hasMethod('canView') || $item->canView()) { if (!$item->hasMethod('canView') || $item->canView()) {

View File

@ -4,11 +4,11 @@ namespace SilverStripe\Forms\GridField;
use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\LiteralField;
use SilverStripe\ORM\DataObjectSchema; use SilverStripe\ORM\DataObjectSchema;
use SilverStripe\ORM\Sortable; use SilverStripe\Model\List\Sortable;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use LogicException; use LogicException;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
/** /**

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
/** /**

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* GridField action menu item interface, this provides data so the action * 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()} * @see {@link GridField_ActionMenu->getColumnContent()}
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record * @param ModelData $record
* *
* @return string $title * @return string $title
*/ */
@ -33,7 +33,7 @@ interface GridField_ActionMenuItem extends GridFieldComponent
* @see {@link GridField_ActionMenu->getColumnContent()} * @see {@link GridField_ActionMenu->getColumnContent()}
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record * @param ModelData $record
* *
* @return array $data * @return array $data
*/ */
@ -46,7 +46,7 @@ interface GridField_ActionMenuItem extends GridFieldComponent
* @see {@link GridField_ActionMenu->getColumnContent()} * @see {@link GridField_ActionMenu->getColumnContent()}
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record * @param ModelData $record
* *
* @return string|null $group * @return string|null $group
*/ */

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Allows GridField_ActionMenuItem to act as a link * Allows GridField_ActionMenuItem to act as a link
@ -15,7 +15,7 @@ interface GridField_ActionMenuLink extends GridField_ActionMenuItem
* @see {@link GridField_ActionMenu->getColumnContent()} * @see {@link GridField_ActionMenu->getColumnContent()}
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record * @param ModelData $record
* *
* @return string $url * @return string $url
*/ */

View File

@ -34,7 +34,7 @@ interface GridField_ColumnProvider extends GridFieldComponent
* HTML for the column, content of the <td> element. * HTML for the column, content of the <td> element.
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record - Record displayed in this row * @param ModelData $record - Record displayed in this row
* @param string $columnName * @param string $columnName
* @return string - HTML for the column. Return NULL to skip. * @return string - HTML for the column. Return NULL to skip.
*/ */
@ -44,7 +44,7 @@ interface GridField_ColumnProvider extends GridFieldComponent
* Attributes for the element containing the content returned by {@link getColumnContent()}. * Attributes for the element containing the content returned by {@link getColumnContent()}.
* *
* @param GridField $gridField * @param GridField $gridField
* @param ViewableData $record displayed in this row * @param ModelData $record displayed in this row
* @param string $columnName * @param string $columnName
* @return array * @return array
*/ */

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
/** /**
* Can modify the data list. * Can modify the data list.

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\ORM\DataObjectInterface; 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 * 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. * Called when a grid field is saved - i.e. the form is submitted.
* *
* @param GridField $grid * @param GridField $grid
* @param DataObjectInterface&ViewableData $record * @param DataObjectInterface&ModelData $record
*/ */
public function handleSave(GridField $grid, DataObjectInterface $record); public function handleSave(GridField $grid, DataObjectInterface $record);
} }

View File

@ -2,9 +2,9 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Grouped dropdown, using optgroup tags. * Grouped dropdown, using optgroup tags.

View File

@ -2,8 +2,8 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Multi-line listbox field, created from a select tag. * Multi-line listbox field, created from a select tag.

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* This field lets you put an arbitrary piece of HTML into your forms. * This field lets you put an arbitrary piece of HTML into your forms.
@ -51,7 +51,7 @@ class LiteralField extends DatalessField
*/ */
public function FieldHolder($properties = []) public function FieldHolder($properties = [])
{ {
if ($this->content instanceof ViewableData) { if ($this->content instanceof ModelData) {
$context = $this->content; $context = $this->content;
if ($properties) { if ($properties) {

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\FieldType\DBMoney; use SilverStripe\ORM\FieldType\DBMoney;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;

View File

@ -3,8 +3,8 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Set of radio buttons designed to emulate a dropdown. * Set of radio buttons designed to emulate a dropdown.

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
/** /**
* Required Fields allows you to set which fields need to be present before * Required Fields allows you to set which fields need to be present before

View File

@ -8,7 +8,7 @@ use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Forms\CompositeField; use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use LogicException; use LogicException;
/** /**

View File

@ -8,14 +8,14 @@ use LogicException;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\Relation; use SilverStripe\ORM\Relation;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\ORM\Search\SearchContext; use SilverStripe\ORM\Search\SearchContext;
use SilverStripe\Security\SecurityToken; use SilverStripe\Security\SecurityToken;
use SilverStripe\ORM\RelationList; use SilverStripe\ORM\RelationList;

View File

@ -3,10 +3,10 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
/** /**

View File

@ -2,8 +2,8 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\Map; use SilverStripe\Model\List\Map;
use ArrayAccess; use ArrayAccess;
/** /**

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms; namespace SilverStripe\Forms;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\View\HTML; use SilverStripe\View\HTML;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Forms;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\Map; use SilverStripe\Model\List\Map;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
/** /**

View File

@ -5,15 +5,15 @@ namespace SilverStripe\Forms;
use http\Exception\InvalidArgumentException; use http\Exception\InvalidArgumentException;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\ORM\Relation; use SilverStripe\ORM\Relation;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\Security\Group; 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 * This formfield represents many-many joins using a tree selector shown in a dropdown styled element
@ -211,7 +211,7 @@ class TreeMultiselectField extends TreeDropdownField
if ($items && count($items ?? [])) { if ($items && count($items ?? [])) {
foreach ($items as $item) { foreach ($items as $item) {
$idArray[] = $item->ID; $idArray[] = $item->ID;
$titleArray[] = ($item instanceof ViewableData) $titleArray[] = ($item instanceof ModelData)
? $item->obj($this->getLabelField())->forTemplate() ? $item->obj($this->getLabelField())->forTemplate()
: Convert::raw2xml($item->{$this->getLabelField()}); : Convert::raw2xml($item->{$this->getLabelField()});
} }

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Forms;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Extensible; use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable; 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 * This validation class handles all form and custom form validation through the use of Required

View File

@ -1,14 +1,13 @@
<?php <?php
namespace SilverStripe\View; namespace SilverStripe\Model;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Dev\Deprecation;
use stdClass; use stdClass;
/** /**
* Lets you wrap a bunch of array data, or object members, into a {@link ViewableData} object. * Lets you wrap a bunch of array data, or object members, into a {@link ModelData} object.
* *
* <code> * <code>
* new ArrayData(array( * new ArrayData(array(
@ -16,10 +15,8 @@ use stdClass;
* "AddAction" => "Add a new Page page", * "AddAction" => "Add a new Page page",
* )); * ));
* </code> * </code>
*
* @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 = []) 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)) { if (is_object($value)) {
$this->array = get_object_vars($value); $this->array = get_object_vars($value);
} elseif (is_array($value)) { } elseif (is_array($value)) {
@ -72,7 +65,7 @@ class ArrayData extends ViewableData
* *
* *
* If the value is an object but not an instance of * 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. * ArrayData.
* *
* If the value is an associative array, it will likewise be * If the value is an associative array, it will likewise be
@ -81,7 +74,7 @@ class ArrayData extends ViewableData
public function getField(string $fieldName): mixed public function getField(string $fieldName): mixed
{ {
$value = $this->array[$fieldName]; $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); return new ArrayData($value);
} elseif (ArrayLib::is_associative($value)) { } elseif (ArrayLib::is_associative($value)) {
return new ArrayData($value); return new ArrayData($value);

View File

@ -1,19 +1,15 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
use ArrayIterator;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; use LogicException;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Debug; use SilverStripe\Dev\Debug;
use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\ExactMatchFilter;
use SilverStripe\ORM\Filters\SearchFilter;
use SilverStripe\ORM\Filters\SearchFilterable; use SilverStripe\ORM\Filters\SearchFilterable;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use Traversable; use Traversable;
/** /**
@ -35,9 +31,8 @@ use Traversable;
* @implements Filterable<T> * @implements Filterable<T>
* @implements Sortable<T> * @implements Sortable<T>
* @implements Limitable<T> * @implements Limitable<T>
* @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; use SearchFilterable;
@ -61,10 +56,6 @@ class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, L
*/ */
public function __construct(array $items = []) 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 ?? []); $this->items = array_values($items ?? []);
parent::__construct(); parent::__construct();
} }
@ -584,7 +575,7 @@ class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, L
return array_key_exists($by, $firstRecord); return array_key_exists($by, $firstRecord);
} }
if ($firstRecord instanceof ViewableData) { if ($firstRecord instanceof ModelData) {
return $firstRecord->hasField($by); return $firstRecord->hasField($by);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
/** /**
* Additional interface for {@link SS_List} classes that are filterable. * Additional interface for {@link SS_List} classes that are filterable.
@ -14,7 +14,6 @@ namespace SilverStripe\ORM;
* *
* @template T * @template T
* @extends SS_List<T> * @extends SS_List<T>
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\Filterable
*/ */
interface Filterable extends SS_List interface Filterable extends SS_List
{ {

View File

@ -1,9 +1,8 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
use SilverStripe\Dev\Deprecation; use SilverStripe\Model\ArrayData;
use SilverStripe\View\ArrayData;
/** /**
* A list decorator that allows a list to be grouped into sub-lists by common * A list decorator that allows a list to be grouped into sub-lists by common
@ -12,19 +11,9 @@ use SilverStripe\View\ArrayData;
* @template TList * @template TList
* @template T * @template T
* @extends ListDecorator<TList, T> * @extends ListDecorator<TList, T>
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\GroupedList
*/ */
class GroupedList extends ListDecorator 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 * @param string $index
* @return array * @return array

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
/** /**
* Additional interface for {@link SS_List} classes that are limitable - able to have a subset of the list extracted. * Additional interface for {@link SS_List} classes that are limitable - able to have a subset of the list extracted.
@ -14,7 +14,6 @@ namespace SilverStripe\ORM;
* *
* @template T * @template T
* @implements SS_List<T> * @implements SS_List<T>
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\Limitable
*/ */
interface Limitable extends SS_List interface Limitable extends SS_List
{ {

View File

@ -1,10 +1,9 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use LogicException; use LogicException;
use SilverStripe\Dev\Deprecation;
use Traversable; use Traversable;
/** /**
@ -18,9 +17,8 @@ use Traversable;
* @implements Sortable<T> * @implements Sortable<T>
* @implements Filterable<T> * @implements Filterable<T>
* @implements Limitable<T> * @implements Limitable<T>
* @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<T> * @var TList<T>
@ -32,12 +30,7 @@ abstract class ListDecorator extends ViewableData implements SS_List, Sortable,
*/ */
public function __construct(SS_List&Sortable&Filterable&Limitable $list) 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); $this->setList($list);
parent::__construct(); parent::__construct();
} }

View File

@ -1,18 +1,15 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
use ArrayAccess; use ArrayAccess;
use BadMethodCallException; use BadMethodCallException;
use Countable; use Countable;
use IteratorAggregate; use IteratorAggregate;
use SilverStripe\Dev\Deprecation;
use Traversable; use Traversable;
/** /**
* Creates a map from an SS_List by defining a key column and a value column. * Creates a map from an SS_List by defining a key column and a value column.
*
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\Map
*/ */
class Map implements ArrayAccess, Countable, IteratorAggregate class Map implements ArrayAccess, Countable, IteratorAggregate
{ {
@ -42,10 +39,6 @@ class Map implements ArrayAccess, Countable, IteratorAggregate
*/ */
public function __construct(SS_List $list, $keyField = "ID", $valueField = "Title") public function __construct(SS_List $list, $keyField = "ID", $valueField = "Title")
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\List\Map', Deprecation::SCOPE_CLASS);
});
$this->list = $list; $this->list = $list;
$this->keyField = $keyField; $this->keyField = $keyField;
$this->valueField = $valueField; $this->valueField = $valueField;

View File

@ -1,15 +1,14 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
use SilverStripe\Control\HTTP; use SilverStripe\Control\HTTP;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use ArrayAccess; use ArrayAccess;
use Exception; use Exception;
use IteratorIterator; use IteratorIterator;
use SilverStripe\Dev\Deprecation;
use Traversable; use Traversable;
/** /**
@ -18,7 +17,6 @@ use Traversable;
* @template TList of SS_List * @template TList of SS_List
* @template T * @template T
* @extends ListDecorator<TList, T> * @extends ListDecorator<TList, T>
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\PaginatedList
*/ */
class PaginatedList extends ListDecorator class PaginatedList extends ListDecorator
{ {
@ -41,10 +39,6 @@ class PaginatedList extends ListDecorator
*/ */
public function __construct(SS_List $list, $request = []) 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) { if (!is_array($request) && !$request instanceof ArrayAccess) {
throw new Exception('The request must be readable as an array.'); throw new Exception('The request must be readable as an array.');
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
use ArrayAccess; use ArrayAccess;
use Countable; use Countable;
@ -12,8 +12,6 @@ use IteratorAggregate;
* @template T * @template T
* @extends ArrayAccess<array-key, T> * @extends ArrayAccess<array-key, T>
* @extends IteratorAggregate<array-key, T> * @extends IteratorAggregate<array-key, T>
*
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\SS_List
*/ */
interface SS_List extends ArrayAccess, Countable, IteratorAggregate interface SS_List extends ArrayAccess, Countable, IteratorAggregate
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\ORM; namespace SilverStripe\Model\List;
/** /**
* Additional interface for {@link SS_List} classes that are sortable. * Additional interface for {@link SS_List} classes that are sortable.
@ -14,7 +14,6 @@ namespace SilverStripe\ORM;
* *
* @template T * @template T
* @implements SS_List<T> * @implements SS_List<T>
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\List\Sortable
*/ */
interface Sortable extends SS_List interface Sortable extends SS_List
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\View; namespace SilverStripe\Model;
use Exception; use Exception;
use InvalidArgumentException; use InvalidArgumentException;
@ -14,24 +14,22 @@ use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Debug; use SilverStripe\Dev\Debug;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use UnexpectedValueException; use UnexpectedValueException;
use SilverStripe\Dev\Deprecation;
/** /**
* A ViewableData object is any object that can be rendered into a template/view. * A ModelData object is any object that can be rendered into a template/view.
* *
* A view interrogates the object being currently rendered in order to get data to render into the template. This data * A view interrogates the object being currently rendered in order to get data to render into the template. This data
* is provided and automatically escaped by ViewableData. Any class that needs to be available to a view (controllers, * is provided and automatically escaped by ModelData. Any class that needs to be available to a view (controllers,
* {@link DataObject}s, page controls) should inherit from this class. * {@link DataObject}s, page controls) should inherit from this class.
*
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\ModelData
*/ */
class ViewableData class ModelData
{ {
use Extensible { use Extensible {
defineMethods as extensibleDefineMethods; defineMethods as extensibleDefineMethods;
@ -70,17 +68,15 @@ class ViewableData
/** /**
* A failover object to attempt to get data from if it is not present on this object. * A failover object to attempt to get data from if it is not present on this object.
*/ */
protected ?ViewableData $failover = null; protected ?ModelData $failover = null;
protected ?ViewableData $customisedObject = null; protected ?ModelData $customisedObject = null;
private array $objCache = []; private array $objCache = [];
public function __construct() public function __construct()
{ {
Deprecation::withNoReplacement(function () { // no-op
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\ModelData', Deprecation::SCOPE_CLASS);
});
} }
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
@ -110,7 +106,7 @@ class ViewableData
/** /**
* Get the value of a property/field on this object. This will check if a method called get{$property} exists, then * Get the value of a property/field on this object. This will check if a method called get{$property} exists, then
* check if a field is available using {@link ViewableData::getField()}, then fall back on a failover object. * check if a field is available using {@link ModelData::getField()}, then fall back on a failover object.
*/ */
public function __get(string $property): mixed public function __get(string $property): mixed
{ {
@ -131,7 +127,7 @@ class ViewableData
/** /**
* Set a property/field on this object. This will check for the existence of a method called set{$property}, then * Set a property/field on this object. This will check for the existence of a method called set{$property}, then
* use the {@link ViewableData::setField()} method. * use the {@link ModelData::setField()} method.
*/ */
public function __set(string $property, mixed $value): void public function __set(string $property, mixed $value): void
{ {
@ -148,7 +144,7 @@ class ViewableData
/** /**
* Set a failover object to attempt to get data from if it is not present on this object. * Set a failover object to attempt to get data from if it is not present on this object.
*/ */
public function setFailover(ViewableData $failover): void public function setFailover(ModelData $failover): void
{ {
// Ensure cached methods from previous failover are removed // Ensure cached methods from previous failover are removed
if ($this->failover) { if ($this->failover) {
@ -162,7 +158,7 @@ class ViewableData
/** /**
* Get the current failover object if set * Get the current failover object if set
*/ */
public function getFailover(): ?ViewableData public function getFailover(): ?ModelData
{ {
return $this->failover; return $this->failover;
} }
@ -192,7 +188,7 @@ class ViewableData
public function setField(string $fieldName, mixed $value): static public function setField(string $fieldName, mixed $value): static
{ {
$this->objCacheClear(); $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 // so the following logic essentially mimics this behaviour, though without the use
// of now deprecated dynamic properties // of now deprecated dynamic properties
if ($this->isAccessibleProperty($fieldName)) { if ($this->isAccessibleProperty($fieldName)) {
@ -219,7 +215,7 @@ class ViewableData
/** /**
* Returns true if a method exists for the current class which isn't private. * 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 private function isAccessibleMethod(string $method): bool
{ {
@ -227,25 +223,25 @@ class ViewableData
// Methods added via extensions are accessible // Methods added via extensions are accessible
return $this->hasCustomMethod($method); return $this->hasCustomMethod($method);
} }
// All methods defined on ViewableData are accessible to ViewableData // All methods defined on ModelData are accessible to ModelData
if (static::class === ViewableData::class) { if (static::class === ModelData::class) {
return true; 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); $reflectionMethod = new ReflectionMethod($this, $method);
return !$reflectionMethod->isPrivate(); return !$reflectionMethod->isPrivate();
} }
/** /**
* Returns true if a property exists for the current class which isn't private. * 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 private function isAccessibleProperty(string $property): bool
{ {
if (!property_exists($this, $property)) { if (!property_exists($this, $property)) {
return false; return false;
} }
if (static::class === ViewableData::class) { if (static::class === ModelData::class) {
return true; return true;
} }
$reflectionProperty = new ReflectionProperty($this, $property); $reflectionProperty = new ReflectionProperty($this, $property);
@ -255,15 +251,15 @@ class ViewableData
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
/** /**
* Add methods from the {@link ViewableData::$failover} object, as well as wrapping any methods prefixed with an * Add methods from the {@link ModelData::$failover} object, as well as wrapping any methods prefixed with an
* underscore into a {@link ViewableData::cachedCall()}. * underscore into a {@link ModelData::cachedCall()}.
* *
* @throws LogicException * @throws LogicException
*/ */
public function defineMethods() public function defineMethods()
{ {
if ($this->failover && !is_object($this->failover)) { 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) { if ($this->failover) {
$this->addMethodsFrom('failover'); $this->addMethodsFrom('failover');
@ -278,23 +274,23 @@ class ViewableData
} }
/** /**
* 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. * 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. * 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))) { if (is_array($data) && (empty($data) || ArrayLib::is_associative($data))) {
$data = new ArrayData($data); $data = new ArrayData($data);
} }
if ($data instanceof ViewableData) { if ($data instanceof ModelData) {
return new ViewableData_Customised($this, $data); return new ModelDataCustomised($this, $data);
} }
throw new InvalidArgumentException( 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 @@ class ViewableData
return static::class; return static::class;
} }
public function getCustomisedObj(): ?ViewableData public function getCustomisedObj(): ?ModelData
{ {
return $this->customisedObject; return $this->customisedObject;
} }
public function setCustomisedObj(ViewableData $object) public function setCustomisedObj(ModelData $object)
{ {
$this->customisedObject = $object; $this->customisedObject = $object;
} }
@ -421,9 +417,9 @@ class ViewableData
* - an SSViewer instance * - an SSViewer instance
* *
* @param string|array|SSViewer $template the template to render into * @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)) { if (!is_object($template)) {
$template = SSViewer::create($template); $template = SSViewer::create($template);
@ -431,7 +427,7 @@ class ViewableData
$data = $this->getCustomisedObj() ?: $this; $data = $this->getCustomisedObj() ?: $this;
if ($customFields instanceof ViewableData) { if ($customFields instanceof ModelData) {
$data = $data->customise($customFields); $data = $data->customise($customFields);
} }
if ($template instanceof SSViewer) { if ($template instanceof SSViewer) {
@ -439,7 +435,7 @@ class ViewableData
} }
throw new UnexpectedValueException( 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 @@ class ViewableData
} }
} }
// 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)) { if (is_array($value) && array_is_list($value)) {
$value = ArrayList::create($value); $value = ArrayList::create($value);
} }
@ -569,7 +565,7 @@ class ViewableData
} }
/** /**
* 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. * without re-running the method.
* *
* @return Object|DBField * @return Object|DBField
@ -586,7 +582,7 @@ class ViewableData
public function hasValue(string $field, array $arguments = [], bool $cache = true): bool public function hasValue(string $field, array $arguments = [], bool $cache = true): bool
{ {
$result = $this->obj($field, $arguments, $cache); $result = $this->obj($field, $arguments, $cache);
if ($result instanceof ViewableData) { if ($result instanceof ModelData) {
return $result->exists(); return $result->exists();
} }
return (bool) $result; return (bool) $result;
@ -629,7 +625,7 @@ class ViewableData
*/ */
public function getViewerTemplates(string $suffix = ''): 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 @@ class ViewableData
* Get part of the current classes ancestry to be used as a CSS class. * 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 * 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 * @uses ClassInfo
*/ */
public function CSSClasses(string $stopAtClass = ViewableData::class): string public function CSSClasses(string $stopAtClass = ModelData::class): string
{ {
$classes = []; $classes = [];
$classAncestry = array_reverse(ClassInfo::ancestry(static::class) ?? []); $classAncestry = array_reverse(ClassInfo::ancestry(static::class) ?? []);
@ -677,8 +673,8 @@ class ViewableData
/** /**
* Return debug information about this object that can be rendered into a template * 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);
} }
} }

View File

@ -1,27 +1,18 @@
<?php <?php
namespace SilverStripe\View; namespace SilverStripe\Model;
use SilverStripe\Dev\Deprecation; class ModelDataCustomised extends ModelData
/**
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\ModelDataCustomised
*/
class ViewableData_Customised extends ViewableData
{ {
protected ViewableData $original; protected ModelData $original;
protected ViewableData $customised; protected ModelData $customised;
/** /**
* Instantiate a new customised ViewableData object * Instantiate a new customised ModelData object
*/ */
public function __construct(ViewableData $originalObject, ViewableData $customisedObject) public function __construct(ModelData $originalObject, ModelData $customisedObject)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\ModelDataCustomised', Deprecation::SCOPE_CLASS);
});
$this->original = $originalObject; $this->original = $originalObject;
$this->customised = $customisedObject; $this->customised = $customisedObject;

View File

@ -1,23 +1,18 @@
<?php <?php
namespace SilverStripe\View; namespace SilverStripe\Model;
use ReflectionObject; use ReflectionObject;
use SilverStripe\Dev\Deprecation;
/** /**
* Allows you to render debug information about a {@link ViewableData} object into a template. * Allows you to render debug information about a {@link ModelData} object into a template.
* @deprecated 5.4.0 Will be renamed to SilverStripe\Model\ModelDataDebugger
*/ */
class ViewableData_Debugger extends ViewableData class ModelDataDebugger extends ModelData
{ {
protected ViewableData $object; protected ModelData $object;
public function __construct(ViewableData $object) public function __construct(ModelData $object)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.4.0', 'Will be renamed to SilverStripe\Model\ModelDataDebugger', Deprecation::SCOPE_CLASS);
});
$this->object = $object; $this->object = $object;
parent::__construct(); parent::__construct();
} }
@ -77,7 +72,7 @@ class ViewableData_Debugger extends ViewableData
// check for an extra attached data // check for an extra attached data
if ($this->object->hasMethod('data') && $this->object->data() != $this->object) { 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; return $debug;

View File

@ -12,8 +12,8 @@ use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\ListDecorator; use SilverStripe\Model\List\ListDecorator;
use SilverStripe\ORM\Map; use SilverStripe\Model\List\Map;
use SilverStripe\ORM\Queries\SQLExpression; use SilverStripe\ORM\Queries\SQLExpression;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\ORM\Queries\SQLDelete; use SilverStripe\ORM\Queries\SQLDelete;

View File

@ -6,7 +6,7 @@ use SilverStripe\Control\Director;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\Debug; use SilverStripe\Dev\Debug;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\PaginatedList; use SilverStripe\Model\List\PaginatedList;
use SilverStripe\ORM\Queries\SQLUpdate; use SilverStripe\ORM\Queries\SQLUpdate;
use SilverStripe\ORM\Queries\SQLInsert; use SilverStripe\ORM\Queries\SQLInsert;
use BadMethodCallException; use BadMethodCallException;

View File

@ -6,9 +6,9 @@ use SilverStripe\Assets\File;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\ORM\PaginatedList; use SilverStripe\Model\List\PaginatedList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use Exception; use Exception;

View File

@ -5,7 +5,7 @@ namespace SilverStripe\ORM;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Debug; use SilverStripe\Dev\Debug;
use SilverStripe\ORM\Queries\SQLConditionGroup; use SilverStripe\ORM\Queries\SQLConditionGroup;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use Exception; use Exception;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; use LogicException;
@ -13,7 +13,12 @@ use BadMethodCallException;
use SilverStripe\ORM\Connect\Query; use SilverStripe\ORM\Connect\Query;
use Traversable; use Traversable;
use SilverStripe\ORM\DataQuery; 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; use SilverStripe\ORM\Filters\SearchFilterable;
/** /**
@ -42,7 +47,7 @@ use SilverStripe\ORM\Filters\SearchFilterable;
* @implements Sortable<T> * @implements Sortable<T>
* @implements Limitable<T> * @implements Limitable<T>
*/ */
class DataList extends ViewableData implements SS_List, Filterable, Sortable, Limitable class DataList extends ModelData implements SS_List, Filterable, Sortable, Limitable
{ {
use SearchFilterable; use SearchFilterable;
@ -924,7 +929,7 @@ class DataList extends ViewableData implements SS_List, Filterable, Sortable, Li
private function setDataObjectEagerLoadedData(DataObject $item): void 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; $itemID = $item->ID;
foreach (array_keys($this->eagerLoadedData) as $relation) { foreach (array_keys($this->eagerLoadedData) as $relation) {
if (array_key_exists($itemID, $this->eagerLoadedData[$relation])) { if (array_key_exists($itemID, $this->eagerLoadedData[$relation])) {

View File

@ -11,6 +11,8 @@ use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Resettable; use SilverStripe\Core\Resettable;
use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Dev\Debug; use SilverStripe\Dev\Debug;
use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
@ -24,6 +26,8 @@ use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\SearchableDropdownField; use SilverStripe\Forms\SearchableDropdownField;
use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18n;
use SilverStripe\i18n\i18nEntityProvider; use SilverStripe\i18n\i18nEntityProvider;
use SilverStripe\Model\List\ArrayList;
use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\Connect\MySQLSchemaManager; use SilverStripe\ORM\Connect\MySQLSchemaManager;
use SilverStripe\ORM\FieldType\DBComposite; use SilverStripe\ORM\FieldType\DBComposite;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
@ -40,7 +44,7 @@ use SilverStripe\Security\Member;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use stdClass; use stdClass;
/** /**
@ -111,7 +115,7 @@ use stdClass;
* @property string $Created Date and time of DataObject creation. * @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 * @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. * Human-readable singular name.
@ -3280,7 +3284,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* can throw a LogicException. * can throw a LogicException.
* *
* @param string $fieldPath List of paths on this object. All items in this path * @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. * @return mixed DBField of the field on the object or a DataList instance.
* @throws LogicException If accessing invalid relations * @throws LogicException If accessing invalid relations
@ -3305,7 +3309,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$component = $singleton->dbObject($relation) ?: $component->relation($relation); $component = $singleton->dbObject($relation) ?: $component->relation($relation);
} elseif ($component instanceof DataObject && ($dbObject = $component->dbObject($relation))) { } elseif ($component instanceof DataObject && ($dbObject = $component->dbObject($relation))) {
$component = $dbObject; $component = $dbObject;
} elseif ($component instanceof ViewableData && $component->hasField($relation)) { } elseif ($component instanceof ModelData && $component->hasField($relation)) {
$component = $component->obj($relation); $component = $component->obj($relation);
} else { } else {
throw new LogicException( throw new LogicException(
@ -3944,7 +3948,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$ancestry = array_reverse($ancestry ?? []); $ancestry = array_reverse($ancestry ?? []);
if ($ancestry) { if ($ancestry) {
foreach ($ancestry as $ancestorClass) { foreach ($ancestry as $ancestorClass) {
if ($ancestorClass === ViewableData::class) { if ($ancestorClass === ModelData::class) {
break; break;
} }
$types = [ $types = [

View File

@ -5,6 +5,7 @@ namespace SilverStripe\ORM;
use Exception; use Exception;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; use LogicException;
use SilverStripe\Core\ArrayLib;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;

View File

@ -3,12 +3,19 @@
namespace SilverStripe\ORM; namespace SilverStripe\ORM;
use SilverStripe\Dev\Debug; use SilverStripe\Dev\Debug;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\Connect\DatabaseException;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use BadMethodCallException; use BadMethodCallException;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; 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 SilverStripe\ORM\Filters\SearchFilterable;
use Traversable; use Traversable;
@ -29,7 +36,7 @@ use Traversable;
* @implements Sortable<T> * @implements Sortable<T>
* @implements Limitable<T> * @implements Limitable<T>
*/ */
class EagerLoadedList extends ViewableData implements Relation, SS_List, Filterable, Sortable, Limitable class EagerLoadedList extends ModelData implements Relation, SS_List, Filterable, Sortable, Limitable
{ {
use SearchFilterable; use SearchFilterable;

View File

@ -6,7 +6,7 @@ use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a boolean field. * Represents a boolean field.
@ -44,7 +44,7 @@ class DBBoolean extends DBField
return ($this->value) ? 'true' : 'false'; return ($this->value) ? 'true' : 'false';
} }
public function saveInto(ViewableData $dataObject): void public function saveInto(ModelData $dataObject): void
{ {
$fieldName = $this->name; $fieldName = $this->name;
if ($fieldName) { if ($fieldName) {

View File

@ -6,7 +6,7 @@ use RuntimeException;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
trait DBClassNameTrait trait DBClassNameTrait
{ {
@ -98,7 +98,7 @@ trait DBClassNameTrait
return array_values($classNames ?? []); 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); parent::setValue($value, $record, $markChanged);

View File

@ -7,7 +7,7 @@ use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\Queries\SQLSelect; 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. * 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 * 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 public function __set(string $property, mixed $value): void
{ {
@ -157,11 +157,11 @@ abstract class DBComposite extends DBField
* If $record is assigned to a dataobject, this field becomes a loose wrapper over * If $record is assigned to a dataobject, this field becomes a loose wrapper over
* the records on that object instead. * 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; $this->isChanged = $markChanged;
@ -198,7 +198,7 @@ abstract class DBComposite extends DBField
$this->record = $dataObject; $this->record = $dataObject;
} }
public function saveInto(ViewableData $dataObject): void public function saveInto(ModelData $dataObject): void
{ {
foreach ($this->compositeDatabaseFields() as $field => $spec) { foreach ($this->compositeDatabaseFields() as $field => $spec) {
// Save into record // Save into record

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\FieldType;
use SilverStripe\Forms\CurrencyField; use SilverStripe\Forms\CurrencyField;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a decimal field containing a currency amount. * Represents a decimal field containing a currency amount.
@ -51,7 +51,7 @@ class DBCurrency extends DBDecimal
return $val; 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; $matches = null;
if (is_numeric($value)) { if (is_numeric($value)) {

View File

@ -11,7 +11,7 @@ use SilverStripe\i18n\i18n;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a date field. * Represents a date field.
@ -42,7 +42,7 @@ class DBDate extends DBField
*/ */
public const ISO_LOCALE = 'en_US'; 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); $value = $this->parseDate($value);
if ($value === false) { if ($value === false) {

View File

@ -12,7 +12,7 @@ use SilverStripe\ORM\DB;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\View\TemplateGlobalProvider; use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a date-time field. * Represents a date-time field.
@ -69,7 +69,7 @@ class DBDatetime extends DBDate implements TemplateGlobalProvider
return $this; 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) { if ($this->immutable) {
// This field is set as immutable so we have to create a new field instance // This field is set as immutable so we have to create a new field instance

View File

@ -5,7 +5,7 @@ namespace SilverStripe\ORM\FieldType;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\Forms\NumericField; use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a Decimal field. * Represents a Decimal field.
@ -67,7 +67,7 @@ class DBDecimal extends DBField
DB::require_field($this->tableName, $this->name, $values); DB::require_field($this->tableName, $this->name, $values);
} }
public function saveInto(ViewableData $model): void public function saveInto(ModelData $model): void
{ {
$fieldName = $this->name; $fieldName = $this->name;

View File

@ -6,7 +6,7 @@ use SilverStripe\Core\Config\Config;
use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\Forms\SelectField; use SilverStripe\Forms\SelectField;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\Connect\MySQLDatabase; use SilverStripe\ORM\Connect\MySQLDatabase;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;

View File

@ -9,7 +9,7 @@ use SilverStripe\Forms\FormField;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Single field in the database. * Single field in the database.
@ -41,7 +41,7 @@ use SilverStripe\View\ViewableData;
* } * }
* </code> * </code>
*/ */
abstract class DBField extends ViewableData implements DBIndexable abstract class DBField extends ModelData implements DBIndexable
{ {
/** /**
@ -198,12 +198,12 @@ abstract class DBField extends ViewableData implements DBIndexable
* and actually changing its values, it needs a {@link $markChanged} * and actually changing its values, it needs a {@link $markChanged}
* parameter. * 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. * @param bool $markChanged Indicate whether this field should be marked changed.
* Set to FALSE if you are initializing this field after construction, rather * Set to FALSE if you are initializing this field after construction, rather
* than setting a new value. * 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; $this->value = $value;
return $this; return $this;
@ -453,7 +453,7 @@ abstract class DBField extends ViewableData implements DBIndexable
/** /**
* Saves this field to the given data object. * Saves this field to the given data object.
*/ */
public function saveInto(ViewableData $model): void public function saveInto(ModelData $model): void
{ {
$fieldName = $this->name; $fieldName = $this->name;
if (empty($fieldName)) { if (empty($fieldName)) {

View File

@ -10,7 +10,7 @@ use SilverStripe\Forms\FormField;
use SilverStripe\Forms\SearchableDropdownField; use SilverStripe\Forms\SearchableDropdownField;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; 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. * A special type Int field used for foreign keys in has_one relationships.
@ -58,7 +58,7 @@ class DBForeignKey extends DBInt
return $field; 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) { if ($record instanceof DataObject) {
$this->object = $record; $this->object = $record;

View File

@ -4,10 +4,10 @@ namespace SilverStripe\ORM\FieldType;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\Forms\NumericField; use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Represents a signed 32 bit integer field. * Represents a signed 32 bit integer field.

View File

@ -2,7 +2,7 @@
namespace SilverStripe\ORM\FieldType; namespace SilverStripe\ORM\FieldType;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a decimal field from 0-1 containing a percentage value. * Represents a decimal field from 0-1 containing a percentage value.
@ -37,7 +37,7 @@ class DBPercentage extends DBDecimal
return number_format($this->value * 100, $this->decimalSize - 2) . '%'; return number_format($this->value * 100, $this->decimalSize - 2) . '%';
} }
public function saveInto(ViewableData $model): void public function saveInto(ModelData $model): void
{ {
parent::saveInto($model); parent::saveInto($model);

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\FieldType;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* A special ForeignKey class that handles relations with arbitrary class types * A special ForeignKey class that handles relations with arbitrary class types
@ -61,7 +61,7 @@ class DBPolymorphicForeignKey extends DBComposite
$this->setField('ID', $value, $markChanged); $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 // Map dataobject value to array
if ($value instanceof DataObject) { if ($value instanceof DataObject) {

View File

@ -5,7 +5,7 @@ namespace SilverStripe\ORM\FieldType;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* A special type Int field used for primary keys. * A special type Int field used for primary keys.
@ -54,7 +54,7 @@ class DBPrimaryKey extends DBInt
return parent::scaffoldFormField($title); 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); parent::setValue($value, $record, $markChanged);

View File

@ -10,7 +10,7 @@ use SilverStripe\i18n\i18n;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* Represents a column in the database with the type 'Time'. * 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 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); $value = $this->parseTime($value);
if ($value === false) { if ($value === false) {

View File

@ -6,9 +6,9 @@ use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Core\Extension; use SilverStripe\Core\Extension;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
@ -16,7 +16,7 @@ use SilverStripe\Versioned\Versioned;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use Exception; 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 * DataObjects that use the Hierarchy extension can be be organised as a hierarchy, with children and parents. The most
@ -416,7 +416,7 @@ class Hierarchy extends Extension
{ {
$ancestry = ClassInfo::ancestry($this->owner); $ancestry = ClassInfo::ancestry($this->owner);
$ancestorClass = array_shift($ancestry); $ancestorClass = array_shift($ancestry);
while ($ancestorClass && !ViewableData::has_extension($ancestorClass, Hierarchy::class)) { while ($ancestorClass && !ModelData::has_extension($ancestorClass, Hierarchy::class)) {
$ancestorClass = array_shift($ancestry); $ancestorClass = array_shift($ancestry);
} }

View File

@ -5,12 +5,12 @@ namespace SilverStripe\ORM\Hierarchy;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; use LogicException;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Contains a set of hierarchical objects generated from a marking compilation run. * Contains a set of hierarchical objects generated from a marking compilation run.

View File

@ -3,7 +3,7 @@
namespace SilverStripe\ORM\RelatedData; namespace SilverStripe\ORM\RelatedData;
use SilverStripe\ORM\DataObject; 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 * Interface used to find all other DataObject instances that are related to a DataObject instance

View File

@ -6,8 +6,8 @@ use ReflectionException;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\Connect\Query; use SilverStripe\ORM\Connect\Query;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectSchema; use SilverStripe\ORM\DataObjectSchema;

View File

@ -2,6 +2,10 @@
namespace SilverStripe\ORM; 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; use SilverStripe\ORM\FieldType\DBField;
/** /**

View File

@ -8,11 +8,11 @@ use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\Filterable; use SilverStripe\Model\List\Filterable;
use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Filters\PartialMatchFilter;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use SilverStripe\ORM\Limitable; use SilverStripe\Model\List\Limitable;
use SilverStripe\ORM\Sortable; use SilverStripe\Model\List\Sortable;
/** /**
* A SearchContext that can be used with non-ORM data. * A SearchContext that can be used with non-ORM data.

View File

@ -11,8 +11,8 @@ use SilverStripe\Forms\FormField;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\Forms\SelectField; use SilverStripe\Forms\SelectField;
use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\CheckboxField;
use InvalidArgumentException; use InvalidArgumentException;

View File

@ -4,6 +4,7 @@ namespace SilverStripe\ORM;
use InvalidArgumentException; use InvalidArgumentException;
use ArrayIterator; use ArrayIterator;
use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use Traversable; use Traversable;

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Security; namespace SilverStripe\Security;
use SilverStripe\Control\HTTPRequest; 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 * An AuthenticationHandler is responsible for providing an identity (in the form of a Member object) for

View File

@ -6,7 +6,7 @@ use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse;
use SilverStripe\Control\Middleware\HTTPMiddleware; use SilverStripe\Control\Middleware\HTTPMiddleware;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\Connect\DatabaseException;
class AuthenticationMiddleware implements HTTPMiddleware class AuthenticationMiddleware implements HTTPMiddleware

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Security; namespace SilverStripe\Security;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\MemberAuthenticator\LoginHandler; use SilverStripe\Security\MemberAuthenticator\LoginHandler;
use SilverStripe\Security\MemberAuthenticator\LogoutHandler; use SilverStripe\Security\MemberAuthenticator\LogoutHandler;

View File

@ -11,7 +11,7 @@ use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\HeaderField; use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\LabelField; use SilverStripe\Forms\LabelField;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
/** /**
* Basic confirmation form implementation. * Basic confirmation form implementation.

View File

@ -30,7 +30,7 @@ use SilverStripe\Forms\TextareaField;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\Forms\TreeDropdownField; use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\Forms\TreeMultiselectField; use SilverStripe\Forms\TreeMultiselectField;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\HasManyList; use SilverStripe\ORM\HasManyList;

View File

@ -23,18 +23,18 @@ use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\Tab; use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TabSet; use SilverStripe\Forms\TabSet;
use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18n;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\HasManyList; use SilverStripe\ORM\HasManyList;
use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\Map; use SilverStripe\Model\List\Map;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\ORM\UnsavedRelationList; use SilverStripe\ORM\UnsavedRelationList;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface; use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Exception\RfcComplianceException; use Symfony\Component\Mime\Exception\RfcComplianceException;

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Security\MemberAuthenticator; namespace SilverStripe\Security\MemberAuthenticator;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Authenticator as BaseAuthenticator; use SilverStripe\Security\Authenticator as BaseAuthenticator;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;

View File

@ -10,7 +10,7 @@ use SilverStripe\Control\RequestHandler;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Security\Authenticator; use SilverStripe\Security\Authenticator;
use SilverStripe\Security\IdentityStore; use SilverStripe\Security\IdentityStore;
use SilverStripe\Security\LoginAttempt; use SilverStripe\Security\LoginAttempt;

View File

@ -7,7 +7,7 @@ use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse;
use SilverStripe\Control\RequestHandler; use SilverStripe\Control\RequestHandler;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Authenticator; use SilverStripe\Security\Authenticator;
use SilverStripe\Security\PasswordExpirationMiddleware; use SilverStripe\Security\PasswordExpirationMiddleware;
use SilverStripe\Security\IdentityStore; use SilverStripe\Security\IdentityStore;

View File

@ -7,7 +7,7 @@ use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse;
use SilverStripe\Control\RequestHandler; use SilverStripe\Control\RequestHandler;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\IdentityStore; use SilverStripe\Security\IdentityStore;
use SilverStripe\Security\LogoutForm; use SilverStripe\Security\LogoutForm;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Security\MemberAuthenticator;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Extensible; use SilverStripe\Core\Extensible;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Authenticator; use SilverStripe\Security\Authenticator;
use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\DefaultAdminService;
use SilverStripe\Security\LoginAttempt; use SilverStripe\Security\LoginAttempt;

View File

@ -12,7 +12,7 @@ use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\PasswordField; use SilverStripe\Forms\PasswordField;
use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\RequiredFields;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\LoginForm as BaseLoginForm; use SilverStripe\Security\LoginForm as BaseLoginForm;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\RememberLoginHash; use SilverStripe\Security\RememberLoginHash;

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Security;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Extensible; use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
/** /**
* This class represents a validator for member passwords. * This class represents a validator for member passwords.

View File

@ -6,10 +6,10 @@ use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Resettable; use SilverStripe\Core\Resettable;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\i18n\i18nEntityProvider; use SilverStripe\i18n\i18nEntityProvider;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\View\TemplateGlobalProvider; use SilverStripe\View\TemplateGlobalProvider;
/** /**
@ -375,7 +375,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl
public static function grant($groupID, $code, $arg = "any") public static function grant($groupID, $code, $arg = "any")
{ {
$permissions = Permission::get()->filter(['GroupID' => $groupID, 'Code' => $code]); $permissions = Permission::get()->filter(['GroupID' => $groupID, 'Code' => $code]);
if ($permissions && $permissions->count() > 0) { if ($permissions && $permissions->count() > 0) {
$perm = $permissions->last(); $perm = $permissions->last();
} else { } else {

View File

@ -5,10 +5,10 @@ namespace SilverStripe\Security;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Forms\FormField; use SilverStripe\Forms\FormField;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use Traversable; use Traversable;
/** /**

View File

@ -18,13 +18,13 @@ use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\TemplateGlobalProvider; use SilverStripe\View\TemplateGlobalProvider;

View File

@ -5,7 +5,7 @@ namespace SilverStripe\View;
use SilverStripe\Core\Convert; 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. * When applying this trait to a class, you also need to add the following casting configuration.
* ``` * ```

View File

@ -3,7 +3,7 @@
namespace SilverStripe\View\Parsers; namespace SilverStripe\View\Parsers;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use Masterminds\HTML5; use Masterminds\HTML5;
use DOMNodeList; use DOMNodeList;
use DOMXPath; use DOMXPath;
@ -16,7 +16,7 @@ use SilverStripe\View\HTML;
* *
* @mixin DOMDocument * @mixin DOMDocument
*/ */
class HTMLValue extends ViewableData class HTMLValue extends ModelData
{ {
public function __construct($fragment = null) public function __construct($fragment = null)
{ {

View File

@ -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 * 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. * depending on the context the lookup is used in.
*/ */
function Lookup_AddLookupStep(&$res, $sub, $method) function Lookup_AddLookupStep(&$res, $sub, $method)

View File

@ -766,7 +766,7 @@ class SSTemplateParser extends Parser implements TemplateParser
/** /**
* The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to * 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. * depending on the context the lookup is used in.
*/ */
function Lookup_AddLookupStep(&$res, $sub, $method) function Lookup_AddLookupStep(&$res, $sub, $method)
@ -1187,7 +1187,7 @@ class SSTemplateParser extends Parser implements TemplateParser
$matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null); $matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null);
$_154 = NULL; $_154 = NULL;
do { do {
$stack[] = $result; $result = $this->construct( $matchrule, "q" ); $stack[] = $result; $result = $this->construct( $matchrule, "q" );
if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) { if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result; $result = array_pop($stack); $subres = $result; $result = array_pop($stack);
@ -1197,7 +1197,7 @@ class SSTemplateParser extends Parser implements TemplateParser
$result = array_pop($stack); $result = array_pop($stack);
$_154 = FALSE; break; $_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) { if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result; $result = array_pop($stack); $subres = $result; $result = array_pop($stack);
@ -1840,7 +1840,7 @@ class SSTemplateParser extends Parser implements TemplateParser
$pos_255 = $this->pos; $pos_255 = $this->pos;
$_254 = NULL; $_254 = NULL;
do { do {
$stack[] = $result; $result = $this->construct( $matchrule, "Not" ); $stack[] = $result; $result = $this->construct( $matchrule, "Not" );
if (( $subres = $this->literal( 'not' ) ) !== FALSE) { if (( $subres = $this->literal( 'not' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result; $result = array_pop($stack); $subres = $result; $result = array_pop($stack);
@ -2235,7 +2235,7 @@ class SSTemplateParser extends Parser implements TemplateParser
else { $_330 = FALSE; break; } else { $_330 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_330 = FALSE; break; } else { $_330 = FALSE; break; }
$stack[] = $result; $result = $this->construct( $matchrule, "Call" ); $stack[] = $result; $result = $this->construct( $matchrule, "Call" );
$_326 = NULL; $_326 = NULL;
do { do {
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
@ -2740,7 +2740,7 @@ class SSTemplateParser extends Parser implements TemplateParser
$_423 = NULL; $_423 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
$_419 = NULL; $_419 = NULL;
do { do {
$_417 = NULL; $_417 = NULL;
@ -3166,7 +3166,7 @@ class SSTemplateParser extends Parser implements TemplateParser
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_555 = FALSE; break; } else { $_555 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); $stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" );
$_508 = NULL; $_508 = NULL;
do { do {
$_506 = NULL; $_506 = NULL;
@ -3225,7 +3225,7 @@ class SSTemplateParser extends Parser implements TemplateParser
$_524 = NULL; $_524 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
$_520 = NULL; $_520 = NULL;
do { do {
$_518 = NULL; $_518 = NULL;
@ -4165,7 +4165,7 @@ class SSTemplateParser extends Parser implements TemplateParser
unset( $pos_685 ); unset( $pos_685 );
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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) { if (( $subres = $this->literal( '%>' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result; $result = array_pop($stack); $subres = $result; $result = array_pop($stack);
@ -4575,7 +4575,7 @@ class SSTemplateParser extends Parser implements TemplateParser
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_743 = FALSE; break; } else { $_743 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); $stack[] = $result; $result = $this->construct( $matchrule, "Tag" );
$_737 = NULL; $_737 = NULL;
do { do {
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }

View File

@ -15,6 +15,7 @@ use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Model\ModelData;
/** /**
* Parses a template file with an *.ss file extension. * Parses a template file with an *.ss file extension.
@ -324,7 +325,7 @@ class SSViewer implements Flushable
/** /**
* Get the current item being processed * Get the current item being processed
* *
* @return ViewableData * @return ModelData
*/ */
public static function topLevel() public static function topLevel()
{ {
@ -549,10 +550,10 @@ class SSViewer implements Flushable
* Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call * 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 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 $overlay Any variables to layer on top of the scope
* @param array $underlay Any variables to layer underneath 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 * @return string The result of executing the template
*/ */
protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null) protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null)
@ -587,11 +588,11 @@ class SSViewer implements Flushable
* *
* The method injects extra HTML in the header via {@link Requirements::includeInHTML()}. * 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 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. * @return DBHTMLText Parsed template output.
*/ */
public function process($item, $arguments = null, $inheritedScope = null) public function process($item, $arguments = null, $inheritedScope = null)

View File

@ -4,7 +4,7 @@ namespace SilverStripe\View;
/** /**
* Defines an extra set of basic methods that can be used in templates * 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 class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
{ {

View File

@ -4,6 +4,7 @@ namespace SilverStripe\View;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Model\ModelData;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
/** /**
@ -130,7 +131,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope
if (!is_array($details)) { if (!is_array($details)) {
$details = [ $details = [
'method' => $details, 'method' => $details,
'casting' => ViewableData::config()->uninherited('default_cast') 'casting' => ModelData::config()->uninherited('default_cast')
]; ];
} }
@ -313,7 +314,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope
if ($val) { if ($val) {
$obj = $val['obj']; $obj = $val['obj'];
if ($name === 'hasValue') { 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))) { } elseif (is_null($obj) || (is_scalar($obj) && !is_string($obj))) {
$result = $obj; // Nulls and non-string scalars don't need casting $result = $obj; // Nulls and non-string scalars don't need casting
} else { } else {
@ -434,7 +435,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope
// Get provided or default cast // Get provided or default cast
$casting = empty($source['casting']) $casting = empty($source['casting'])
? ViewableData::config()->uninherited('default_cast') ? ModelData::config()->uninherited('default_cast')
: $source['casting']; : $source['casting'];
return DBField::create_field($casting, $value); return DBField::create_field($casting, $value);

View File

@ -5,7 +5,7 @@ namespace SilverStripe\View;
use ArrayIterator; use ArrayIterator;
use Countable; use Countable;
use Iterator; use Iterator;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBBoolean; use SilverStripe\ORM\FieldType\DBBoolean;
use SilverStripe\ORM\FieldType\DBText; use SilverStripe\ORM\FieldType\DBText;
use SilverStripe\ORM\FieldType\DBFloat; use SilverStripe\ORM\FieldType\DBFloat;
@ -16,7 +16,7 @@ use SilverStripe\ORM\FieldType\DBField;
* This tracks the current scope for an SSViewer instance. It has three goals: * This tracks the current scope for an SSViewer instance. It has three goals:
* - Handle entering & leaving sub-scopes in loops and withs * - Handle entering & leaving sub-scopes in loops and withs
* - Track Up and Top * - 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 * 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). * for each step, we use indexes into the itemStack (which already has to exist).
@ -132,7 +132,7 @@ class SSViewer_Scope
$item = $this->convertScalarToDBField($item); $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)) { if (is_array($item) && array_is_list($item)) {
$item = ArrayList::create($item); $item = ArrayList::create($item);
} }

View File

@ -8,9 +8,9 @@ use Psr\SimpleCache\CacheInterface;
use Psr\SimpleCache\InvalidArgumentException; use Psr\SimpleCache\InvalidArgumentException;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\Embed\Embeddable; use SilverStripe\View\Embed\Embeddable;
use SilverStripe\View\HTML; use SilverStripe\View\HTML;
use SilverStripe\View\Parsers\ShortcodeHandler; use SilverStripe\View\Parsers\ShortcodeHandler;

View File

@ -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 * 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 * 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. * The first letter of the template variable is case-insensitive. However the method name is always case sensitive.
* *

View File

@ -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 * 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 * 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. * The first letter of the template variable is case-insensitive. However the method name is always case sensitive.
* *

View File

@ -11,7 +11,7 @@ use SilverStripe\Dev\SapphireTest;
use SilverStripe\Dev\TestMailer; use SilverStripe\Dev\TestMailer;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Part\DataPart; use Symfony\Component\Mime\Part\DataPart;
@ -394,12 +394,12 @@ class EmailTest extends SapphireTest
$this->assertSame('My content', $email->getData()->Content); $this->assertSame('My content', $email->getData()->Content);
} }
public function testDataWithViewableData(): void public function testDataWithModelData(): void
{ {
$email = new Email(); $email = new Email();
$viewableData = new ViewableData(); $model = new ModelData();
$viewableData->ABC = 'XYZ'; $model->ABC = 'XYZ';
$email->setData($viewableData); $email->setData($model);
$data = $email->getData(); $data = $email->getData();
$this->assertSame('XYZ', $data->ABC); $this->assertSame('XYZ', $data->ABC);
$this->assertSame(true, $data->IsEmail); $this->assertSame(true, $data->IsEmail);

View File

@ -6,7 +6,7 @@ use SilverStripe\Control\Director;
use SilverStripe\Control\RSS\RSSFeed; use SilverStripe\Control\RSS\RSSFeed;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\Parsers\ShortcodeParser; use SilverStripe\View\Parsers\ShortcodeParser;
class RSSFeedTest extends SapphireTest class RSSFeedTest extends SapphireTest

View File

@ -3,9 +3,9 @@
namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; namespace SilverStripe\Control\Tests\RSS\RSSFeedTest;
use SilverStripe\Control\Controller; 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. // RSS-feed items must have $casting/$db information.
private static $casting = [ private static $casting = [

View File

@ -2,9 +2,9 @@
namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; 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 // ItemB tests without $casting

View File

@ -2,9 +2,9 @@
namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; 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. // ItemC tests fields - Title has casting, Content doesn't.
private static $casting = [ private static $casting = [

View File

@ -2,9 +2,9 @@
namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; 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 // ItemD test fields - all fields use casting but Content & AltContent cast as HTMLText
private static $casting = [ private static $casting = [

View File

@ -3,9 +3,9 @@
namespace SilverStripe\Control\Tests\RequestHandlingTest; namespace SilverStripe\Control\Tests\RequestHandlingTest;
use SilverStripe\Dev\TestOnly; 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() public function failoverMethod()
{ {

View File

@ -3,7 +3,7 @@
namespace SilverStripe\ORM\Tests; namespace SilverStripe\ORM\Tests;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -23,7 +23,7 @@ use SilverStripe\Core\Tests\ClassInfoTest\WithCustomTable;
use SilverStripe\Core\Tests\ClassInfoTest\WithRelation; use SilverStripe\Core\Tests\ClassInfoTest\WithRelation;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class ClassInfoTest extends SapphireTest class ClassInfoTest extends SapphireTest
@ -150,7 +150,7 @@ class ClassInfoTest extends SapphireTest
{ {
$ancestry = ClassInfo::ancestry(ChildClass::class); $ancestry = ClassInfo::ancestry(ChildClass::class);
$expect = [ $expect = [
'silverstripe\\view\\viewabledata' => ViewableData::class, 'silverstripe\\model\\modeldata' => ModelData::class,
'silverstripe\\orm\\dataobject' => DataObject::class, 'silverstripe\\orm\\dataobject' => DataObject::class,
'silverstripe\\core\tests\classinfotest\\baseclass' => BaseClass::class, 'silverstripe\\core\tests\classinfotest\\baseclass' => BaseClass::class,
'silverstripe\\core\tests\classinfotest\\childclass' => ChildClass::class, 'silverstripe\\core\tests\classinfotest\\childclass' => ChildClass::class,

View File

@ -3,12 +3,12 @@
namespace SilverStripe\Core\Tests\Injector\InjectorTest; namespace SilverStripe\Core\Tests\Injector\InjectorTest;
use SilverStripe\Dev\TestOnly; 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; protected $backend;

View File

@ -1,9 +1,9 @@
<?php <?php
namespace SilverStripe\ORM\Tests; namespace SilverStripe\Core\Tests\Validation;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
class ValidationExceptionTest extends SapphireTest class ValidationExceptionTest extends SapphireTest

View File

@ -1,10 +1,10 @@
<?php <?php
namespace SilverStripe\ORM\Tests; namespace SilverStripe\Core\Tests\Validation;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
class ValidationResultTest extends SapphireTest class ValidationResultTest extends SapphireTest
{ {

View File

@ -2,14 +2,14 @@
namespace SilverStripe\Dev\Tests; namespace SilverStripe\Dev\Tests;
use SilverStripe\Dev\Constraint\ViewableDataContains; use SilverStripe\Dev\Constraint\ModelDataContains;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Dev\Tests\ViewableDataContainsTest\TestObject; use SilverStripe\Dev\Tests\ModelDataContainsTest\TestObject;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class ViewableDataContainsTest extends SapphireTest class ModelDataContainsTest extends SapphireTest
{ {
private $test_data = [ private $test_data = [
'FirstName' => 'Ingo', 'FirstName' => 'Ingo',
@ -53,7 +53,7 @@ class ViewableDataContainsTest extends SapphireTest
#[DataProvider('provideMatchesForList')] #[DataProvider('provideMatchesForList')]
public function testEvaluateMatchesCorrectlyArrayData($match) public function testEvaluateMatchesCorrectlyArrayData($match)
{ {
$constraint = new ViewableDataContains($match); $constraint = new ModelDataContains($match);
$item = ArrayData::create($this->test_data); $item = ArrayData::create($this->test_data);
@ -66,7 +66,7 @@ class ViewableDataContainsTest extends SapphireTest
#[DataProvider('provideMatchesForList')] #[DataProvider('provideMatchesForList')]
public function testEvaluateMatchesCorrectlyDataObject($match) public function testEvaluateMatchesCorrectlyDataObject($match)
{ {
$constraint = new ViewableDataContains($match); $constraint = new ModelDataContains($match);
$item = Member::create($this->test_data); $item = Member::create($this->test_data);
@ -79,7 +79,7 @@ class ViewableDataContainsTest extends SapphireTest
#[DataProvider('provideInvalidMatchesForList')] #[DataProvider('provideInvalidMatchesForList')]
public function testEvaluateDoesNotMatchWrongMatchInArrayData($match) public function testEvaluateDoesNotMatchWrongMatchInArrayData($match)
{ {
$constraint = new ViewableDataContains($match); $constraint = new ModelDataContains($match);
$item = ArrayData::create($this->test_data); $item = ArrayData::create($this->test_data);
@ -92,7 +92,7 @@ class ViewableDataContainsTest extends SapphireTest
#[DataProvider('provideInvalidMatchesForList')] #[DataProvider('provideInvalidMatchesForList')]
public function testEvaluateDoesNotMatchWrongMatchInDataObject($match) public function testEvaluateDoesNotMatchWrongMatchInDataObject($match)
{ {
$constraint = new ViewableDataContains($match); $constraint = new ModelDataContains($match);
$item = Member::create($this->test_data); $item = Member::create($this->test_data);
@ -102,10 +102,10 @@ class ViewableDataContainsTest extends SapphireTest
public function testFieldAccess() public function testFieldAccess()
{ {
$data = new TestObject(['name' => 'Damian']); $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)); $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)); $this->assertFalse($constraint->evaluate($data, '', true));
} }
} }

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Dev\Tests;
use SilverStripe\Dev\Constraint\SSListContainsOnly; use SilverStripe\Dev\Constraint\SSListContainsOnly;
use SilverStripe\Dev\Constraint\SSListContainsOnlyMatchingItems; use SilverStripe\Dev\Constraint\SSListContainsOnlyMatchingItems;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
class SSListContainsOnlyMatchingItemsTest extends SapphireTest class SSListContainsOnlyMatchingItemsTest extends SapphireTest

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Dev\Tests;
use SilverStripe\Dev\Constraint\SSListContainsOnly; use SilverStripe\Dev\Constraint\SSListContainsOnly;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Dev\Tests;
use SilverStripe\Dev\Constraint\SSListContains; use SilverStripe\Dev\Constraint\SSListContains;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Dev\Tests;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\Dev\Tests\ViewableDataContainsTest; namespace SilverStripe\Dev\Tests\ModelDataContainsTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class TestObject extends ViewableData implements TestOnly class TestObject extends ModelData implements TestOnly
{ {
protected $data = null; protected $data = null;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Forms\Tests;
use SilverStripe\Forms\Tests\CheckboxSetFieldTest\Article; use SilverStripe\Forms\Tests\CheckboxSetFieldTest\Article;
use SilverStripe\Forms\Tests\CheckboxSetFieldTest\Tag; use SilverStripe\Forms\Tests\CheckboxSetFieldTest\Tag;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
@ -16,7 +16,7 @@ use SilverStripe\Forms\CheckboxSetField;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\RequiredFields;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class CheckboxSetFieldTest extends SapphireTest class CheckboxSetFieldTest extends SapphireTest
{ {

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms\Tests; namespace SilverStripe\Forms\Tests;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Dev\CSSContentParser; use SilverStripe\Dev\CSSContentParser;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\DropdownField;
@ -11,8 +11,8 @@ use SilverStripe\Forms\RequiredFields;
use SilverStripe\Forms\FormTemplateHelper; use SilverStripe\Forms\FormTemplateHelper;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\ORM\Map; use SilverStripe\Model\List\Map;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class DropdownFieldTest extends SapphireTest class DropdownFieldTest extends SapphireTest
@ -171,7 +171,7 @@ class DropdownFieldTest extends SapphireTest
$form->method('getHTMLID') $form->method('getHTMLID')
->willReturn($formName); ->willReturn($formName);
$source = [ $source = [
'first' => 'value', 'first' => 'value',
0 => 'otherValue' 0 => 'otherValue'

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Forms\Tests\EmailFieldTest;
use Exception; use Exception;
use SilverStripe\Forms\Validator; use SilverStripe\Forms\Validator;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
class TestValidator extends Validator class TestValidator extends Validator
{ {

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\Tests; namespace SilverStripe\Forms\Tests;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\FieldType\DBEnum; use SilverStripe\ORM\FieldType\DBEnum;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;

View File

@ -31,7 +31,7 @@ use SilverStripe\Forms\Tip;
use SilverStripe\Forms\ToggleCompositeField; use SilverStripe\Forms\ToggleCompositeField;
use SilverStripe\Forms\TreeDropdownField; use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\Forms\TreeDropdownField_Readonly; use SilverStripe\Forms\TreeDropdownField_Readonly;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Group; use SilverStripe\Security\Group;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\PermissionCheckboxSetField; use SilverStripe\Security\PermissionCheckboxSetField;

View File

@ -27,11 +27,11 @@ use SilverStripe\Forms\Tests\FormTest\TestController;
use SilverStripe\Forms\TextareaField; use SilverStripe\Forms\TextareaField;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\Forms\TimeField; use SilverStripe\Forms\TimeField;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\NullSecurityToken; use SilverStripe\Security\NullSecurityToken;
use SilverStripe\Security\RandomGenerator; use SilverStripe\Security\RandomGenerator;
use SilverStripe\Security\SecurityToken; use SilverStripe\Security\SecurityToken;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
@ -765,9 +765,9 @@ class FormTest extends FunctionalTest
): void { ): void {
$this->get('FormTest_ControllerWithSecurityToken'); $this->get('FormTest_ControllerWithSecurityToken');
[ $form, $button, $data, $withSecurityToken ] = [ ...$formData ]; [ $form, $button, $data, $withSecurityToken ] = [ ...$formData ];
if (is_null($button)) { if (is_null($button)) {
$response = $this->submitForm($form, $button, $data, $withSecurityToken); $response = $this->submitForm($form, $button, $data, $withSecurityToken);
$this->assertEquals($statusCode, $response->getStatusCode(), $testMessage); $this->assertEquals($statusCode, $response->getStatusCode(), $testMessage);

View File

@ -14,8 +14,8 @@ use SilverStripe\Forms\MoneyField;
use SilverStripe\Forms\NumericField; use SilverStripe\Forms\NumericField;
use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\RequiredFields;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
class ControllerWithSpecialSubmittedValueFields extends Controller implements TestOnly class ControllerWithSpecialSubmittedValueFields extends Controller implements TestOnly

View File

@ -13,8 +13,8 @@ use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\NumericField; use SilverStripe\Forms\NumericField;
use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\RequiredFields;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
class TestController extends Controller implements TestOnly class TestController extends Controller implements TestOnly

View File

@ -17,7 +17,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;

View File

@ -17,8 +17,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Stadium; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Stadium;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldAddExistingAutocompleterTest extends FunctionalTest class GridFieldAddExistingAutocompleterTest extends FunctionalTest
{ {

View File

@ -15,9 +15,9 @@ use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Person;
use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PeopleGroup; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PeopleGroup;
use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Category; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Category;
use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldAddNewButtonTest extends SapphireTest class GridFieldAddNewButtonTest extends SapphireTest
{ {

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Forms\Tests\GridField;
use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyOtherComponent; use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyOtherComponent;
use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyComponent; use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyComponent;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\Forms\GridField\GridFieldConfig;
use SilverStripe\Forms\GridField\GridField_URLHandler; use SilverStripe\Forms\GridField\GridField_URLHandler;

View File

@ -9,8 +9,8 @@ use SilverStripe\Security\Member;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig_Base; use SilverStripe\Forms\GridField\GridFieldConfig_Base;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use stdClass; use stdClass;
class GridFieldDataColumnsTest extends SapphireTest class GridFieldDataColumnsTest extends SapphireTest

View File

@ -20,12 +20,12 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\Security\SecurityToken; use SilverStripe\Security\SecurityToken;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class GridFieldDeleteActionTest extends SapphireTest class GridFieldDeleteActionTest extends SapphireTest

View File

@ -24,8 +24,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PeopleGroup;
use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Person; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Person;
use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PolymorphicPeopleGroup; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PolymorphicPeopleGroup;
use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class GridFieldDetailFormTest extends FunctionalTest class GridFieldDetailFormTest extends FunctionalTest

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest; namespace SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class ArrayDataWithID extends ArrayData implements TestOnly class ArrayDataWithID extends ArrayData implements TestOnly
{ {

View File

@ -13,7 +13,7 @@ use SilverStripe\Forms\GridField\GridFieldDetailForm;
use SilverStripe\Forms\GridField\GridFieldEditButton; use SilverStripe\Forms\GridField\GridFieldEditButton;
use SilverStripe\Forms\GridField\GridFieldToolbarHeader; use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\GridField\GridFieldViewButton; use SilverStripe\Forms\GridField\GridFieldViewButton;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
class TestController extends Controller implements TestOnly class TestController extends Controller implements TestOnly
{ {

View File

@ -9,8 +9,8 @@ use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig_Base; use SilverStripe\Forms\GridField\GridFieldConfig_Base;
use SilverStripe\Forms\GridField\GridFieldDetailForm; use SilverStripe\Forms\GridField\GridFieldDetailForm;
use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest; use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldDetailForm_ItemRequestTest extends SapphireTest class GridFieldDetailForm_ItemRequestTest extends SapphireTest
{ {

View File

@ -6,7 +6,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Dev\CSSContentParser; use SilverStripe\Dev\CSSContentParser;

View File

@ -8,7 +8,7 @@ use ReflectionMethod;
use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\NoView; use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\NoView;
use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\Team;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\Forms\GridField\GridFieldConfig;
@ -17,7 +17,7 @@ use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldDataColumns; use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldPaginator; use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldExportButtonTest extends SapphireTest class GridFieldExportButtonTest extends SapphireTest
{ {

View File

@ -18,10 +18,10 @@ use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\Mom;
use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\NonDataObject; use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\NonDataObject;
use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\Team;
use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\TeamGroup; use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\TeamGroup;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldFilterHeaderTest extends SapphireTest class GridFieldFilterHeaderTest extends SapphireTest
{ {

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest; namespace SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class NonDataObject extends ArrayData implements TestOnly class NonDataObject extends ArrayData implements TestOnly
{ {

View File

@ -15,7 +15,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
class GridFieldLazyLoaderTest extends SapphireTest class GridFieldLazyLoaderTest extends SapphireTest

View File

@ -6,7 +6,7 @@ use LogicException;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldLevelup; use SilverStripe\Forms\GridField\GridFieldLevelup;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldLevelupTest extends SapphireTest class GridFieldLevelupTest extends SapphireTest
{ {

View File

@ -15,7 +15,7 @@ use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
class GridFieldPaginatorTest extends FunctionalTest class GridFieldPaginatorTest extends FunctionalTest

View File

@ -14,8 +14,8 @@ use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldDataColumns; use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject; use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldPrintButtonTest extends SapphireTest class GridFieldPrintButtonTest extends SapphireTest
{ {

View File

@ -12,7 +12,7 @@ use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest;
use SilverStripe\Forms\GridField\GridFieldStateManager; use SilverStripe\Forms\GridField\GridFieldStateManager;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject; use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class GridFieldStateManagerTest extends SapphireTest class GridFieldStateManagerTest extends SapphireTest
{ {

View File

@ -33,8 +33,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
use SilverStripe\Forms\Tests\ValidatorTest\TestValidator; use SilverStripe\Forms\Tests\ValidatorTest\TestValidator;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Group; use SilverStripe\Security\Group;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Versioned\VersionedGridFieldStateExtension; use SilverStripe\Versioned\VersionedGridFieldStateExtension;

View File

@ -5,8 +5,8 @@ namespace SilverStripe\Forms\Tests\GridField\GridFieldTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridField_DataManipulator; use SilverStripe\Forms\GridField\GridField_DataManipulator;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
class Component2 implements GridField_DataManipulator, TestOnly class Component2 implements GridField_DataManipulator, TestOnly
{ {

View File

@ -8,7 +8,7 @@ use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\Forms\GridField\GridFieldConfig;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
class TestController extends Controller implements TestOnly class TestController extends Controller implements TestOnly
{ {

View File

@ -10,7 +10,7 @@ use SilverStripe\Dev\CSSContentParser;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\ListboxField; use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\RequiredFields;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class ListboxFieldTest extends SapphireTest class ListboxFieldTest extends SapphireTest
{ {

View File

@ -1,19 +1,19 @@
<?php <?php
namespace SilverStripe\View\Tests; namespace SilverStripe\Model\Tests;
use SilverStripe\ORM\ArrayLib; use SilverStripe\Core\ArrayLib;
use SilverStripe\ORM\FieldType\DBVarchar; use SilverStripe\ORM\FieldType\DBVarchar;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use stdClass; use stdClass;
class ArrayDataTest extends SapphireTest class ArrayDataTest extends SapphireTest
{ {
public function testViewableDataItemsInsideArraydataArePreserved() public function testModelDataItemsInsideArraydataArePreserved()
{ {
/* ViewableData objects will be preserved, but other objects will be converted */ /* ModelData objects will be preserved, but other objects will be converted */
$arrayData = new ArrayData( $arrayData = new ArrayData(
[ [
"A" => new DBVarchar("A"), "A" => new DBVarchar("A"),

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\View\Tests\ArrayDataTest; namespace SilverStripe\Model\Tests\ArrayDataTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;

View File

@ -1,12 +1,13 @@
<?php <?php
namespace SilverStripe\ORM\Tests; namespace SilverStripe\Model\Tests\List;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\Filterable; use SilverStripe\Model\List\Filterable;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\Model\List\Map;
use stdClass; use stdClass;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
@ -331,7 +332,7 @@ class ArrayListTest extends SapphireTest
$map = $list->map('ID', 'Name'); $map = $list->map('ID', 'Name');
// Items added after calling map should not be included retroactively // Items added after calling map should not be included retroactively
$list->add(['ID' => 7, 'Name' => 'Andrew']); $list->add(['ID' => 7, 'Name' => 'Andrew']);
$this->assertInstanceOf('SilverStripe\\ORM\\Map', $map); $this->assertInstanceOf(Map::class, $map);
$this->assertEquals( $this->assertEquals(
[ [
1 => 'Steve', 1 => 'Steve',

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\ORM\Tests\ArrayListTest; namespace SilverStripe\Model\Tests\List\ArrayListTest;
class TestObject class TestObject
{ {

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\ORM\Tests; namespace SilverStripe\Model\Tests\List;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\GroupedList; use SilverStripe\Model\List\GroupedList;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
/** /**
* Tests for the {@link GroupedList} list decorator. * Tests for the {@link GroupedList} list decorator.

View File

@ -1,14 +1,14 @@
<?php <?php
namespace SilverStripe\ORM\Tests; namespace SilverStripe\Model\Tests\List;
use ArrayIterator; use ArrayIterator;
use LogicException; use LogicException;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\ListDecorator; use SilverStripe\Model\List\ListDecorator;
use SilverStripe\ORM\SS_List; use SilverStripe\Model\List\SS_List;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
/** /**

View File

@ -1,25 +1,25 @@
<?php <?php
namespace SilverStripe\ORM\Tests; namespace SilverStripe\Model\Tests\List;
use SilverStripe\ORM\Map; use SilverStripe\Model\List\Map;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Tests\DataObjectTest\Team; use SilverStripe\Model\Tests\List\MapTest\SubTeam;
use SilverStripe\ORM\Tests\DataObjectTest\TeamComment; use SilverStripe\Model\Tests\List\MapTest\Team;
use SilverStripe\Model\Tests\List\MapTest\TeamComment;
class MapTest extends SapphireTest class MapTest extends SapphireTest
{ {
protected static $fixture_file = 'MapTest.yml';
// Borrow the model from DataObjectTest
protected static $fixture_file = 'DataObjectTest.yml';
public static function getExtraDataObjects() public static function getExtraDataObjects()
{ {
return array_merge( return [
DataObjectTest::$extra_data_objects, Team::class,
ManyManyListTest::$extra_data_objects TeamComment::class,
); SubTeam::class,
];
} }
public function testValues() public function testValues()
@ -99,7 +99,7 @@ class MapTest extends SapphireTest
{ {
$list = Team::get(); $list = Team::get();
$map = new Map($list); $map = new Map($list);
$this->assertEquals('Team 1', $map[$this->idFromFixture(DataObjectTest\Team::class, 'team1')]); $this->assertEquals('Team 1', $map[$this->idFromFixture(Team::class, 'team1')]);
} }
public function testSetKeyFieldAndValueField() public function testSetKeyFieldAndValueField()

View File

@ -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

View File

@ -0,0 +1,14 @@
<?php
namespace SilverStripe\Model\Tests\List\MapTest;
use SilverStripe\Dev\TestOnly;
class SubTeam extends Team implements TestOnly
{
private static $table_name = 'MapTest_SubTeam';
private static $has_one = [
"ParentTeam" => Team::class,
];
}

View File

@ -0,0 +1,39 @@
<?php
namespace SilverStripe\Model\Tests\List\MapTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\HasManyList;
/**
* @property string Title
* @property string DatabaseField
* @property array SalaryCap
* @property string FoundationYear
* @property bool CustomHydratedField
* @method HasManyList SubTeams()
* @method HasManyList Comments()
*/
class Team extends DataObject implements TestOnly
{
private static $table_name = 'MapTest_Team';
private static $db = [
'Title' => '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;
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace SilverStripe\Model\Tests\List\MapTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
class TeamComment extends DataObject implements TestOnly
{
private static $table_name = 'MapTest_TeamComment';
private static $db = [
'Name' => 'Varchar',
'Comment' => 'Text'
];
private static $has_one = [
'Team' => Team::class
];
private static $default_sort = '"Name" ASC';
}

View File

@ -1,30 +1,28 @@
<?php <?php
namespace SilverStripe\ORM\Tests; namespace SilverStripe\Model\Tests\List;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\PaginatedList; use SilverStripe\Model\List\PaginatedList;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\ORM\Tests\DataObjectTest\Player; use SilverStripe\Model\ArrayData;
use SilverStripe\View\ArrayData;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Model\Tests\List\PaginatedListTest\Player;
/** /**
* Tests for the {@link SilverStripe\ORM\PaginatedList} class. * Tests for the {@link SilverStripe\Model\List\PaginatedList} class.
*/ */
class PaginatedListTest extends SapphireTest class PaginatedListTest extends SapphireTest
{ {
protected static $fixture_file = 'PaginatedListTest.yml';
protected static $fixture_file = 'DataObjectTest.yml';
public static function getExtraDataObjects() public static function getExtraDataObjects()
{ {
return array_merge( return [
DataObjectTest::$extra_data_objects, Player::class,
ManyManyListTest::$extra_data_objects ];
);
} }
public function testPageStart() public function testPageStart()

View File

@ -0,0 +1,13 @@
SilverStripe\Model\Tests\List\PaginatedListTest\Player:
captain1:
FirstName: Captain
Surname: Zookeeper
ShirtNumber: '007'
IsRetired: 1
captain2:
FirstName: Captain 2
Surname: Aaron
player1:
FirstName: Player 1
player2:
FirstName: Player 2

View File

@ -0,0 +1,21 @@
<?php
namespace SilverStripe\Model\Tests\List\PaginatedListTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Security\Member;
class Player extends Member implements TestOnly
{
private static $table_name = 'PaginatedListTest_Player';
private static $db = [
'IsRetired' => 'Boolean',
'ShirtNumber' => 'Varchar',
];
private static $searchable_fields = [
'IsRetired',
'ShirtNumber'
];
}

View File

@ -0,0 +1,55 @@
<?php
namespace SilverStripe\Model\Tests;
use SilverStripe\Dev\Constraint\ModelDataContains;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Model\ArrayData;
use SilverStripe\Model\ModelDataCustomised;
/**
* Test for ModelDataCustomised.
*/
class ModelDataCustomisedTest extends SapphireTest
{
public function testNestedModelDataCustomisedAsCustomised()
{
$outerCustomised = ModelDataCustomised::create($this->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);
}
}

View File

@ -1,28 +1,27 @@
<?php <?php
namespace SilverStripe\View\Tests; namespace SilverStripe\Model\Tests;
use ReflectionMethod; use ReflectionMethod;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\FieldType\DBText; use SilverStripe\ORM\FieldType\DBText;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\Model\Tests\ModelDataTest\ModelDataTestExtension;
use SilverStripe\View\Tests\ViewableDataTest\ViewableDataTestExtension; use SilverStripe\Model\Tests\ModelDataTest\ModelDataTestObject;
use SilverStripe\View\Tests\ViewableDataTest\ViewableDataTestObject; use SilverStripe\Model\ModelData;
use SilverStripe\View\ViewableData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
/** /**
* See {@link SSViewerTest->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. * from a template-parsing perspective.
*/ */
class ViewableDataTest extends SapphireTest class ModelDataTest extends SapphireTest
{ {
protected static $required_extensions = [ protected static $required_extensions = [
ViewableDataTestObject::class => [ ModelDataTestObject::class => [
ViewableDataTestExtension::class, ModelDataTestExtension::class,
], ],
]; ];
@ -57,10 +56,10 @@ class ViewableDataTest extends SapphireTest
public function testRequiresCasting() public function testRequiresCasting()
{ {
$caster = new ViewableDataTest\Castable(); $caster = new ModelDataTest\Castable();
$this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $caster->obj('alwaysCasted'));
$this->assertInstanceOf(ViewableDataTest\Caster::class, $caster->obj('noCastingInformation')); $this->assertInstanceOf(ModelDataTest\Caster::class, $caster->obj('noCastingInformation'));
$this->assertInstanceOf(DBText::class, $caster->obj('arrayOne')); $this->assertInstanceOf(DBText::class, $caster->obj('arrayOne'));
$this->assertInstanceOf(ArrayList::class, $caster->obj('arrayTwo')); $this->assertInstanceOf(ArrayList::class, $caster->obj('arrayTwo'));
@ -68,20 +67,20 @@ class ViewableDataTest extends SapphireTest
public function testFailoverRequiresCasting() public function testFailoverRequiresCasting()
{ {
$caster = new ViewableDataTest\Castable(); $caster = new ModelDataTest\Castable();
$container = new ViewableDataTest\Container(); $container = new ModelDataTest\Container();
$container->setFailover($caster); $container->setFailover($caster);
$this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $container->obj('alwaysCasted')); $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $container->obj('alwaysCasted'));
$this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $caster->obj('alwaysCasted'));
$this->assertInstanceOf(ViewableDataTest\Caster::class, $container->obj('noCastingInformation')); $this->assertInstanceOf(ModelDataTest\Caster::class, $container->obj('noCastingInformation'));
$this->assertInstanceOf(ViewableDataTest\Caster::class, $caster->obj('noCastingInformation')); $this->assertInstanceOf(ModelDataTest\Caster::class, $caster->obj('noCastingInformation'));
} }
public function testCastingXMLVal() public function testCastingXMLVal()
{ {
$caster = new ViewableDataTest\Castable(); $caster = new ModelDataTest\Castable();
$this->assertEquals('casted', $caster->XML_val('alwaysCasted')); $this->assertEquals('casted', $caster->XML_val('alwaysCasted'));
$this->assertEquals('casted', $caster->XML_val('noCastingInformation')); $this->assertEquals('casted', $caster->XML_val('noCastingInformation'));
@ -93,43 +92,43 @@ class ViewableDataTest extends SapphireTest
public function testArrayCustomise() public function testArrayCustomise()
{ {
$viewableData = new ViewableDataTest\Castable(); $modelData = new ModelDataTest\Castable();
$newViewableData = $viewableData->customise( $newModelData = $modelData->customise(
[ [
'test' => 'overwritten', 'test' => 'overwritten',
'alwaysCasted' => 'overwritten' 'alwaysCasted' => 'overwritten'
] ]
); );
$this->assertEquals('test', $viewableData->XML_val('test')); $this->assertEquals('test', $modelData->XML_val('test'));
$this->assertEquals('casted', $viewableData->XML_val('alwaysCasted')); $this->assertEquals('casted', $modelData->XML_val('alwaysCasted'));
$this->assertEquals('overwritten', $newViewableData->XML_val('test')); $this->assertEquals('overwritten', $newModelData->XML_val('test'));
$this->assertEquals('overwritten', $newViewableData->XML_val('alwaysCasted')); $this->assertEquals('overwritten', $newModelData->XML_val('alwaysCasted'));
$this->assertEquals('castable', $viewableData->forTemplate()); $this->assertEquals('castable', $modelData->forTemplate());
$this->assertEquals('castable', $newViewableData->forTemplate()); $this->assertEquals('castable', $newModelData->forTemplate());
} }
public function testObjectCustomise() public function testObjectCustomise()
{ {
$viewableData = new ViewableDataTest\Castable(); $modelData = new ModelDataTest\Castable();
$newViewableData = $viewableData->customise(new ViewableDataTest\RequiresCasting()); $newModelData = $modelData->customise(new ModelDataTest\RequiresCasting());
$this->assertEquals('test', $viewableData->XML_val('test')); $this->assertEquals('test', $modelData->XML_val('test'));
$this->assertEquals('casted', $viewableData->XML_val('alwaysCasted')); $this->assertEquals('casted', $modelData->XML_val('alwaysCasted'));
$this->assertEquals('overwritten', $newViewableData->XML_val('test')); $this->assertEquals('overwritten', $newModelData->XML_val('test'));
$this->assertEquals('casted', $newViewableData->XML_val('alwaysCasted')); $this->assertEquals('casted', $newModelData->XML_val('alwaysCasted'));
$this->assertEquals('castable', $viewableData->forTemplate()); $this->assertEquals('castable', $modelData->forTemplate());
$this->assertEquals('casted', $newViewableData->forTemplate()); $this->assertEquals('casted', $newModelData->forTemplate());
} }
public function testDefaultValueWrapping() public function testDefaultValueWrapping()
{ {
$data = new ArrayData(['Title' => 'SomeTitleValue']); $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->assertTrue($data->hasValue('Title'));
$this->assertFalse($data->hasValue('SomethingElse')); $this->assertFalse($data->hasValue('SomethingElse'));
// this should cast the raw string to a StringField since we are // this should cast the raw string to a StringField since we are
@ -148,7 +147,7 @@ class ViewableDataTest extends SapphireTest
'Argument' => 'ArgumentType', 'Argument' => 'ArgumentType',
'ArrayArgument' => 'ArrayArgumentType' 'ArrayArgument' => 'ArrayArgumentType'
]; ];
$obj = new ViewableDataTest\CastingClass(); $obj = new ModelDataTest\CastingClass();
foreach ($expected as $field => $class) { foreach ($expected as $field => $class) {
$this->assertEquals( $this->assertEquals(
@ -161,7 +160,7 @@ class ViewableDataTest extends SapphireTest
public function testObjWithCachedStringValueReturnsValidObject() public function testObjWithCachedStringValueReturnsValidObject()
{ {
$obj = new ViewableDataTest\NoCastingInformation(); $obj = new ModelDataTest\NoCastingInformation();
// Save a literal string into cache // Save a literal string into cache
$cache = true; $cache = true;
@ -184,8 +183,8 @@ class ViewableDataTest extends SapphireTest
public function testCaching() public function testCaching()
{ {
$objCached = new ViewableDataTest\Cached(); $objCached = new ModelDataTest\Cached();
$objNotCached = new ViewableDataTest\NotCached(); $objNotCached = new ModelDataTest\NotCached();
$objCached->Test = 'AAA'; $objCached->Test = 'AAA';
$objNotCached->Test = 'AAA'; $objNotCached->Test = 'AAA';
@ -203,15 +202,15 @@ class ViewableDataTest extends SapphireTest
public function testSetFailover() public function testSetFailover()
{ {
$failover = new ViewableData(); $failover = new ModelData();
$container = new ViewableDataTest\Container(); $container = new ModelDataTest\Container();
$container->setFailover($failover); $container->setFailover($failover);
$this->assertSame($failover, $container->getFailover(), 'getFailover() returned a different object'); $this->assertSame($failover, $container->getFailover(), 'getFailover() returned a different object');
$this->assertFalse($container->hasMethod('testMethod'), 'testMethod() is already defined when it shouldnt be'); $this->assertFalse($container->hasMethod('testMethod'), 'testMethod() is already defined when it shouldnt be');
// Ensure that defined methods detected from the failover aren't cached when setting a new failover // 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')); $this->assertTrue($container->hasMethod('testMethod'));
// Test the reverse - that defined methods previously detected in a failover are removed if they no longer exist // Test the reverse - that defined methods previously detected in a failover are removed if they no longer exist
@ -222,10 +221,10 @@ class ViewableDataTest extends SapphireTest
public function testIsAccessibleMethod() public function testIsAccessibleMethod()
{ {
$reflectionMethod = new ReflectionMethod(ViewableData::class, 'isAccessibleMethod'); $reflectionMethod = new ReflectionMethod(ModelData::class, 'isAccessibleMethod');
$reflectionMethod->setAccessible(true); $reflectionMethod->setAccessible(true);
$object = new ViewableDataTestObject(); $object = new ModelDataTestObject();
$viewableData = new ViewableData(); $modelData = new ModelData();
$output = $reflectionMethod->invokeArgs($object, ['privateMethod']); $output = $reflectionMethod->invokeArgs($object, ['privateMethod']);
$this->assertFalse($output, 'Method should not be accessible'); $this->assertFalse($output, 'Method should not be accessible');
@ -239,7 +238,7 @@ class ViewableDataTest extends SapphireTest
$output = $reflectionMethod->invokeArgs($object, ['missingMethod']); $output = $reflectionMethod->invokeArgs($object, ['missingMethod']);
$this->assertFalse($output, 'Method should not be accessible'); $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'); $this->assertTrue($output, 'Method should be accessible');
$output = $reflectionMethod->invokeArgs($object, ['publicMethodFromExtension']); $output = $reflectionMethod->invokeArgs($object, ['publicMethodFromExtension']);
@ -254,9 +253,9 @@ class ViewableDataTest extends SapphireTest
public function testIsAccessibleProperty() public function testIsAccessibleProperty()
{ {
$reflectionMethod = new ReflectionMethod(ViewableData::class, 'isAccessibleProperty'); $reflectionMethod = new ReflectionMethod(ModelData::class, 'isAccessibleProperty');
$reflectionMethod->setAccessible(true); $reflectionMethod->setAccessible(true);
$object = new ViewableDataTestObject(); $object = new ModelDataTestObject();
$output = $reflectionMethod->invokeArgs($object, ['privateProperty']); $output = $reflectionMethod->invokeArgs($object, ['privateProperty']);
$this->assertFalse($output, 'Property should not be accessible'); $this->assertFalse($output, 'Property should not be accessible');
@ -270,19 +269,19 @@ class ViewableDataTest extends SapphireTest
$output = $reflectionMethod->invokeArgs($object, ['missingProperty']); $output = $reflectionMethod->invokeArgs($object, ['missingProperty']);
$this->assertFalse($output, 'Property should not be accessible'); $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'); $this->assertTrue($output, 'Property should be accessible');
} }
public function testDynamicData() public function testDynamicData()
{ {
$obj = (object) ['SomeField' => [1, 2, 3]]; $obj = (object) ['SomeField' => [1, 2, 3]];
$viewableData = new ViewableData(); $modelData = new ModelData();
$this->assertFalse($viewableData->hasDynamicData('abc')); $this->assertFalse($modelData->hasDynamicData('abc'));
$viewableData->setDynamicData('abc', $obj); $modelData->setDynamicData('abc', $obj);
$this->assertTrue($viewableData->hasDynamicData('abc')); $this->assertTrue($modelData->hasDynamicData('abc'));
$this->assertSame($obj, $viewableData->getDynamicData('abc')); $this->assertSame($obj, $modelData->getDynamicData('abc'));
$this->assertSame($obj, $viewableData->abc); $this->assertSame($obj, $modelData->abc);
} }
public static function provideWrapArrayInObj(): array public static function provideWrapArrayInObj(): array
@ -305,8 +304,8 @@ class ViewableDataTest extends SapphireTest
#[DataProvider('provideWrapArrayInObj')] #[DataProvider('provideWrapArrayInObj')]
public function testWrapArrayInObj(array $arr, string $expectedClass): void public function testWrapArrayInObj(array $arr, string $expectedClass): void
{ {
$viewableData = new ViewableData(); $modelData = new ModelData();
$viewableData->arr = $arr; $modelData->arr = $arr;
$this->assertInstanceOf($expectedClass, $viewableData->obj('arr')); $this->assertInstanceOf($expectedClass, $modelData->obj('arr'));
} }
} }

View File

@ -0,0 +1,11 @@
<?php
namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Model\ModelData;
class Cached extends ModelData implements TestOnly
{
public $Test;
}

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class Castable extends ViewableData implements TestOnly class Castable extends ModelData implements TestOnly
{ {
private static $default_cast = Caster::class; private static $default_cast = Caster::class;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class Caster extends ViewableData implements TestOnly class Caster extends ModelData implements TestOnly
{ {
public function forTemplate(): string public function forTemplate(): string

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class CastingClass extends ViewableData implements TestOnly class CastingClass extends ModelData implements TestOnly
{ {
private static $casting = [ private static $casting = [
'Field' => 'CastingType', 'Field' => 'CastingType',

View File

@ -0,0 +1,11 @@
<?php
namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Model\ModelData;
class Container extends ModelData implements TestOnly
{
}

View File

@ -0,0 +1,13 @@
<?php
namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Model\ModelData;
class Failover extends ModelData implements TestOnly
{
public function testMethod()
{
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Model\ModelData;
class NoCastingInformation extends ModelData implements TestOnly
{
public function noCastingInformation()
{
return "No casting information";
}
}

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class NotCached extends ViewableData implements TestOnly class NotCached extends ModelData implements TestOnly
{ {
public $Test; public $Test;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class RequiresCasting extends ViewableData implements TestOnly class RequiresCasting extends ModelData implements TestOnly
{ {
public $test = 'overwritten'; public $test = 'overwritten';

View File

@ -1,12 +1,12 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class UnescapedCaster extends ViewableData implements TestOnly class UnescapedCaster extends ModelData implements TestOnly
{ {
protected $value; protected $value;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
class ViewableDataTestObject extends DataObject implements TestOnly class ModelDataTestObject extends DataObject implements TestOnly
{ {
private string $privateProperty = 'private property'; private string $privateProperty = 'private property';

View File

@ -1,11 +1,11 @@
<?php <?php
namespace SilverStripe\View\Tests\ViewableDataTest; namespace SilverStripe\Model\Tests\ModelDataTest;
use SilverStripe\Core\Extension; use SilverStripe\Core\Extension;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class ViewableDataTestExtension extends Extension implements TestOnly class ModelDataTestExtension extends Extension implements TestOnly
{ {
private function privateMethodFromExtension(): string private function privateMethodFromExtension(): string
{ {

View File

@ -6,7 +6,7 @@ use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class TestDbField extends DBField implements TestOnly class TestDbField extends DBField implements TestOnly
{ {
@ -35,7 +35,7 @@ class TestDbField extends DBField implements TestOnly
public $saveIntoCalledCount = 0; public $saveIntoCalledCount = 0;
public function saveInto(ViewableData $model): void public function saveInto(ModelData $model): void
{ {
$this->saveIntoCalledCount++; $this->saveIntoCalledCount++;
parent::saveInto($model); parent::saveInto($model);

View File

@ -12,7 +12,7 @@ use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\EagerLoadedList; use SilverStripe\ORM\EagerLoadedList;
use SilverStripe\ORM\ManyManyThroughList; 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\EagerLoadObject;
use SilverStripe\ORM\Tests\DataListTest\EagerLoading\EagerLoadSubClassObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\EagerLoadSubClassObject;
use SilverStripe\ORM\Tests\DataListTest\EagerLoading\HasOneEagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\HasOneEagerLoadObject;

View File

@ -12,7 +12,7 @@ use SilverStripe\ORM\Connect\MySQLiConnector;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\Filterable; use SilverStripe\Model\List\Filterable;
use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\ExactMatchFilter;
use SilverStripe\ORM\Tests\DataObjectTest\DataListQueryCounter; use SilverStripe\ORM\Tests\DataObjectTest\DataListQueryCounter;
use SilverStripe\ORM\Tests\DataObjectTest\Fixture; use SilverStripe\ORM\Tests\DataObjectTest\Fixture;

View File

@ -22,9 +22,9 @@ use SilverStripe\ORM\Tests\DataObjectTest\Company;
use SilverStripe\ORM\Tests\DataObjectTest\Player; use SilverStripe\ORM\Tests\DataObjectTest\Player;
use SilverStripe\ORM\Tests\DataObjectTest\Team; use SilverStripe\ORM\Tests\DataObjectTest\Team;
use SilverStripe\ORM\Tests\DataObjectTest\TreeNode; use SilverStripe\ORM\Tests\DataObjectTest\TreeNode;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use ReflectionMethod; use ReflectionMethod;
use stdClass; use stdClass;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
@ -1586,7 +1586,7 @@ class DataObjectTest extends SapphireTest
/* Return false if you don't pass it a subclass of DataObject */ /* Return false if you don't pass it a subclass of DataObject */
$this->assertFalse($schema->classHasTable(DataObject::class)); $this->assertFalse($schema->classHasTable(DataObject::class));
$this->assertFalse($schema->classHasTable(ViewableData::class)); $this->assertFalse($schema->classHasTable(ModelData::class));
/* Invalid class name */ /* Invalid class name */
$this->assertFalse($schema->classHasTable("ThisIsntADataObject")); $this->assertFalse($schema->classHasTable("ThisIsntADataObject"));

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\DataObjectTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
class ValidatedObject extends DataObject implements TestOnly class ValidatedObject extends DataObject implements TestOnly
{ {

View File

@ -6,7 +6,7 @@ use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\ORM\Tests\DataQueryTest\ObjectE; use SilverStripe\ORM\Tests\DataQueryTest\ObjectE;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;

View File

@ -10,7 +10,7 @@ use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Connect\MySQLiConnector; use SilverStripe\ORM\Connect\MySQLiConnector;
use SilverStripe\ORM\EagerLoadedList; use SilverStripe\ORM\EagerLoadedList;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\Filterable; use SilverStripe\Model\List\Filterable;
use SilverStripe\ORM\Tests\DataObjectTest\EquipmentCompany; use SilverStripe\ORM\Tests\DataObjectTest\EquipmentCompany;
use SilverStripe\ORM\Tests\DataObjectTest\Fan; use SilverStripe\ORM\Tests\DataObjectTest\Fan;
use SilverStripe\ORM\Tests\DataObjectTest\Player; use SilverStripe\ORM\Tests\DataObjectTest\Player;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\Filters;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Filters\EndsWithFilter; use SilverStripe\ORM\Filters\EndsWithFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -8,7 +8,7 @@ use SilverStripe\ORM\Filters\ExactMatchFilter;
use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Task; use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Task;
use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Project; use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Project;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\Filters;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Filters\GreaterThanFilter; use SilverStripe\ORM\Filters\GreaterThanFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class GreaterThanFilterTest extends SapphireTest class GreaterThanFilterTest extends SapphireTest

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\Filters;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Filters\GreaterThanOrEqualFilter; use SilverStripe\ORM\Filters\GreaterThanOrEqualFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class GreaterThanOrEqualFilterTest extends SapphireTest class GreaterThanOrEqualFilterTest extends SapphireTest

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\Filters;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Filters\LessThanFilter; use SilverStripe\ORM\Filters\LessThanFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class LessThanFilterTest extends SapphireTest class LessThanFilterTest extends SapphireTest

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\Filters;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Filters\LessThanOrEqualFilter; use SilverStripe\ORM\Filters\LessThanOrEqualFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class LessThanOrEqualFilterTest extends SapphireTest class LessThanOrEqualFilterTest extends SapphireTest

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\Filters;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Filters\PartialMatchFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\ORM\Tests\Filters;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Filters\StartsWithFilter; use SilverStripe\ORM\Filters\StartsWithFilter;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -2,7 +2,7 @@
namespace SilverStripe\ORM\Tests; namespace SilverStripe\ORM\Tests;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;

View File

@ -2,7 +2,7 @@
namespace SilverStripe\ORM\Tests; 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\Base;
use SilverStripe\ORM\Tests\RelatedDataServiceTest\Belongs; use SilverStripe\ORM\Tests\RelatedDataServiceTest\Belongs;
use SilverStripe\ORM\Tests\RelatedDataServiceTest\HasMany; use SilverStripe\ORM\Tests\RelatedDataServiceTest\HasMany;

View File

@ -10,7 +10,7 @@ use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\SQLite\SQLite3Database; use SilverStripe\SQLite\SQLite3Database;
use SilverStripe\PostgreSQL\PostgreSQLDatabase; use SilverStripe\PostgreSQL\PostgreSQLDatabase;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\Connect\DatabaseException;
use SilverStripe\ORM\Tests\SQLSelectTest\CteDatesObject; use SilverStripe\ORM\Tests\SQLSelectTest\CteDatesObject;
use SilverStripe\ORM\Tests\SQLSelectTest\CteRecursiveObject; use SilverStripe\ORM\Tests\SQLSelectTest\CteRecursiveObject;

View File

@ -8,12 +8,12 @@ use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\HiddenField;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\ExactMatchFilter;
use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\SearchFilter;
use SilverStripe\ORM\Filters\StartsWithFilter; use SilverStripe\ORM\Filters\StartsWithFilter;
use SilverStripe\ORM\Search\BasicSearchContext; use SilverStripe\ORM\Search\BasicSearchContext;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
class BasicSearchContextTest extends SapphireTest class BasicSearchContextTest extends SapphireTest

View File

@ -18,7 +18,7 @@ use SilverStripe\ORM\Filters\EndsWithFilter;
use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\ExactMatchFilter;
use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Filters\PartialMatchFilter;
use SilverStripe\ORM\Search\SearchContext; use SilverStripe\ORM\Search\SearchContext;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
class SearchContextTest extends SapphireTest class SearchContextTest extends SapphireTest
{ {

View File

@ -6,7 +6,7 @@ use InvalidArgumentException;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\RequiredFields;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Security\Group; use SilverStripe\Security\Group;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;

View File

@ -8,7 +8,7 @@ use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Authenticator; use SilverStripe\Security\Authenticator;
use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\DefaultAdminService;
use SilverStripe\Security\IdentityStore; use SilverStripe\Security\IdentityStore;

View File

@ -17,9 +17,9 @@ use SilverStripe\i18n\i18n;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\Map; use SilverStripe\Model\List\Map;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Group; use SilverStripe\Security\Group;
use SilverStripe\Security\IdentityStore; use SilverStripe\Security\IdentityStore;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;

View File

@ -4,7 +4,7 @@ namespace SilverStripe\Security\Tests\MemberTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\Core\Extension; use SilverStripe\Core\Extension;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
/** /**
* Extension that does something extra when changing a member's password * Extension that does something extra when changing a member's password

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Security\Tests\MemberTest; namespace SilverStripe\Security\Tests\MemberTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\PasswordValidator; use SilverStripe\Security\PasswordValidator;
class VerySpecificPasswordValidator extends PasswordValidator implements TestOnly class VerySpecificPasswordValidator extends PasswordValidator implements TestOnly

View File

@ -5,7 +5,7 @@ namespace SilverStripe\Security\Tests;
use SilverStripe\Control\Director; use SilverStripe\Control\Director;
use SilverStripe\Control\Tests\HttpRequestMockBuilder; use SilverStripe\Control\Tests\HttpRequestMockBuilder;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\ValidationException; use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Security\PasswordExpirationMiddleware; use SilverStripe\Security\PasswordExpirationMiddleware;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;

View File

@ -18,7 +18,7 @@ use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBEnum; use SilverStripe\ORM\FieldType\DBEnum;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\LoginAttempt; use SilverStripe\Security\LoginAttempt;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator; use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator;

View File

@ -8,7 +8,7 @@ use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\ValidationResult; use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Security\Authenticator; use SilverStripe\Security\Authenticator;
use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\DefaultAdminService;
use SilverStripe\Security\IdentityStore; use SilverStripe\Security\IdentityStore;

View File

@ -8,7 +8,7 @@ use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18n;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use Silverstripe\Assets\Dev\TestAssetStore; use Silverstripe\Assets\Dev\TestAssetStore;
use SilverStripe\View\Requirements_Backend; use SilverStripe\View\Requirements_Backend;
use SilverStripe\Core\Manifest\ResourceURLGenerator; use SilverStripe\Core\Manifest\ResourceURLGenerator;

View File

@ -15,7 +15,7 @@ use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\Component\Cache\Psr16Cache; 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 class SSViewerCacheBlockTest extends SapphireTest
{ {

View File

@ -15,14 +15,14 @@ use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18n;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\PaginatedList; use SilverStripe\Model\List\PaginatedList;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\Security\SecurityToken; use SilverStripe\Security\SecurityToken;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\View\Requirements_Backend; use SilverStripe\View\Requirements_Backend;
use SilverStripe\View\SSTemplateParseException; use SilverStripe\View\SSTemplateParseException;
@ -31,8 +31,8 @@ use SilverStripe\View\SSViewer;
use SilverStripe\View\SSViewer_FromString; use SilverStripe\View\SSViewer_FromString;
use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModel; use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModel;
use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModelController; use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModelController;
use SilverStripe\View\Tests\SSViewerTest\TestViewableData; use SilverStripe\View\Tests\SSViewerTest\TestModelData;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
@ -598,7 +598,7 @@ SS;
#[DataProvider('provideArgumentTypes')] #[DataProvider('provideArgumentTypes')]
public function testArgumentTypes(string $expected, string $template) 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() public function testObjectDotArguments()
@ -767,7 +767,7 @@ after'
public function testTypesArePreserved($expected, $templateArg) public function testTypesArePreserved($expected, $templateArg)
{ {
$data = new ArrayData([ $data = new ArrayData([
'Test' => new TestViewableData() 'Test' => new TestModelData()
]); ]);
$this->assertEquals($expected, $this->render("\$Test.Type({$templateArg})", $data)); $this->assertEquals($expected, $this->render("\$Test.Type({$templateArg})", $data));
@ -777,7 +777,7 @@ after'
public function testTypesArePreservedAsIncludeArguments($expected, $templateArg) public function testTypesArePreservedAsIncludeArguments($expected, $templateArg)
{ {
$data = new ArrayData([ $data = new ArrayData([
'Test' => new TestViewableData() 'Test' => new TestModelData()
]); ]);
$this->assertEquals( $this->assertEquals(
@ -789,7 +789,7 @@ after'
public function testTypePreservationInConditionals() public function testTypePreservationInConditionals()
{ {
$data = new ArrayData([ $data = new ArrayData([
'Test' => new TestViewableData() 'Test' => new TestModelData()
]); ]);
// Types in conditionals // Types in conditionals
@ -1326,12 +1326,12 @@ after'
} }
/** /**
* 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. * this test just ensures that basic casting is correctly applied during template parsing.
*/ */
public function testCastingHelpers() public function testCastingHelpers()
{ {
$vd = new SSViewerTest\TestViewableData(); $vd = new SSViewerTest\TestModelData();
$vd->TextValue = '<b>html</b>'; $vd->TextValue = '<b>html</b>';
$vd->HTMLValue = '<b>html</b>'; $vd->HTMLValue = '<b>html</b>';
$vd->UncastedValue = '<b>html</b>'; $vd->UncastedValue = '<b>html</b>';
@ -1364,8 +1364,8 @@ after'
$t = SSViewer::fromString('$HTMLValue.XML')->process($vd) $t = SSViewer::fromString('$HTMLValue.XML')->process($vd)
); );
// Uncasted value (falls back to ViewableData::$default_cast="Text") // Uncasted value (falls back to ModelData::$default_cast="Text")
$vd = new SSViewerTest\TestViewableData(); $vd = new SSViewerTest\TestModelData();
$vd->UncastedValue = '<b>html</b>'; $vd->UncastedValue = '<b>html</b>';
$this->assertEquals( $this->assertEquals(
'&lt;b&gt;html&lt;/b&gt;', '&lt;b&gt;html&lt;/b&gt;',
@ -1974,7 +1974,7 @@ after'
</html>' </html>'
); );
$tmpl = new SSViewer($tmplFile); $tmpl = new SSViewer($tmplFile);
$obj = new ViewableData(); $obj = new ModelData();
$obj->InsertedLink = DBField::create_field( $obj->InsertedLink = DBField::create_field(
'HTMLFragment', 'HTMLFragment',
'<a class="inserted" href="#anchor">InsertedLink</a>' '<a class="inserted" href="#anchor">InsertedLink</a>'
@ -2029,7 +2029,7 @@ after'
</html>' </html>'
); );
$tmpl = new SSViewer($tmplFile); $tmpl = new SSViewer($tmplFile);
$obj = new ViewableData(); $obj = new ModelData();
$obj->InsertedLink = DBField::create_field( $obj->InsertedLink = DBField::create_field(
'HTMLFragment', 'HTMLFragment',
'<a class="inserted" href="#anchor">InsertedLink</a>' '<a class="inserted" href="#anchor">InsertedLink</a>'
@ -2171,13 +2171,13 @@ EOC;
Requirements::set_backend($backend); Requirements::set_backend($backend);
$this->assertEquals(1, substr_count($template->process(new ViewableData()) ?? '', "a.css")); $this->assertEquals(1, substr_count($template->process(new ModelData()) ?? '', "a.css"));
$this->assertEquals(1, substr_count($template->process(new ViewableData()) ?? '', "b.css")); $this->assertEquals(1, substr_count($template->process(new ModelData()) ?? '', "b.css"));
// if we disable the requirements then we should get nothing // if we disable the requirements then we should get nothing
$template->includeRequirements(false); $template->includeRequirements(false);
$this->assertEquals(0, substr_count($template->process(new ViewableData()) ?? '', "a.css")); $this->assertEquals(0, substr_count($template->process(new ModelData()) ?? '', "a.css"));
$this->assertEquals(0, substr_count($template->process(new ViewableData()) ?? '', "b.css")); $this->assertEquals(0, substr_count($template->process(new ModelData()) ?? '', "b.css"));
} }
public function testRequireCallInTemplateInclude() public function testRequireCallInTemplateInclude()
@ -2190,7 +2190,7 @@ EOC;
$this->assertEquals( $this->assertEquals(
1, 1,
substr_count( substr_count(
$template->process(new ViewableData()) ?? '', $template->process(new ModelData()) ?? '',
"tests/php/View/SSViewerTest/javascript/RequirementsTest_a.js" "tests/php/View/SSViewerTest/javascript/RequirementsTest_a.js"
) )
); );

View File

@ -3,11 +3,11 @@
namespace SilverStripe\View\Tests\SSViewerTest; namespace SilverStripe\View\Tests\SSViewerTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class CacheTestData extends ViewableData implements TestOnly class CacheTestData extends ModelData implements TestOnly
{ {
public $testWithCalls = 0; public $testWithCalls = 0;

View File

@ -3,10 +3,10 @@
namespace SilverStripe\View\Tests\SSViewerTest; namespace SilverStripe\View\Tests\SSViewerTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
class LevelTestData extends ViewableData implements TestOnly class LevelTestData extends ModelData implements TestOnly
{ {
protected $depth; protected $depth;

View File

@ -2,13 +2,13 @@
namespace SilverStripe\View\Tests\SSViewerTest; namespace SilverStripe\View\Tests\SSViewerTest;
use SilverStripe\ORM\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* A test fixture that will echo back the template item * A test fixture that will echo back the template item
*/ */
class TestFixture extends ViewableData class TestFixture extends ModelData
{ {
protected $name; protected $name;
@ -45,7 +45,7 @@ class TestFixture extends ViewableData
return $output; return $output;
} else { } else {
if (preg_match('/NotSet/i', $fieldName ?? '')) { if (preg_match('/NotSet/i', $fieldName ?? '')) {
return new ViewableData(); return new ModelData();
} else { } else {
return new TestFixture($childName); return new TestFixture($childName);
} }

View File

@ -3,13 +3,13 @@
namespace SilverStripe\View\Tests\SSViewerTest; namespace SilverStripe\View\Tests\SSViewerTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
/** /**
* @property string $TextValue * @property string $TextValue
* @property string $HTMLValue * @property string $HTMLValue
*/ */
class TestViewableData extends ViewableData implements TestOnly class TestModelData extends ModelData implements TestOnly
{ {
private static $default_cast = 'Text'; private static $default_cast = 'Text';

View File

@ -1,55 +0,0 @@
<?php
namespace SilverStripe\View\Tests;
use SilverStripe\Dev\Constraint\ViewableDataContains;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\View\ArrayData;
use SilverStripe\View\ViewableData_Customised;
/**
* Test for ViewableData_Customised.
*/
class ViewableDataCustomisedTest extends SapphireTest
{
public function testNestedViewableDataCustomisedAsCustomised()
{
$outerCustomised = ViewableData_Customised::create($this->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);
}
}

View File

@ -1,11 +0,0 @@
<?php
namespace SilverStripe\View\Tests\ViewableDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData;
class Cached extends ViewableData implements TestOnly
{
public $Test;
}

View File

@ -1,11 +0,0 @@
<?php
namespace SilverStripe\View\Tests\ViewableDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData;
class Container extends ViewableData implements TestOnly
{
}

View File

@ -1,13 +0,0 @@
<?php
namespace SilverStripe\View\Tests\ViewableDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData;
class Failover extends ViewableData implements TestOnly
{
public function testMethod()
{
}
}

View File

@ -1,14 +0,0 @@
<?php
namespace SilverStripe\View\Tests\ViewableDataTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData;
class NoCastingInformation extends ViewableData implements TestOnly
{
public function noCastingInformation()
{
return "No casting information";
}
}

View File

@ -10,7 +10,7 @@ use SilverStripe\Dev\SapphireTest;
use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18n;
use SilverStripe\i18n\Messages\MessageProvider; use SilverStripe\i18n\Messages\MessageProvider;
use SilverStripe\i18n\Messages\Symfony\SymfonyMessageProvider; use SilverStripe\i18n\Messages\Symfony\SymfonyMessageProvider;
use SilverStripe\View\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSViewer;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;

View File

@ -20,7 +20,7 @@ use SilverStripe\View\SSViewer;
use SilverStripe\View\SSViewer_DataPresenter; use SilverStripe\View\SSViewer_DataPresenter;
use SilverStripe\View\ThemeResourceLoader; use SilverStripe\View\ThemeResourceLoader;
use SilverStripe\View\ThemeManifest; use SilverStripe\View\ThemeManifest;
use SilverStripe\View\ViewableData; use SilverStripe\Model\ModelData;
use Symfony\Component\Translation\Loader\ArrayLoader; use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\Translator;
@ -73,7 +73,7 @@ trait i18nTestManifest
{ {
// force SSViewer_DataPresenter to cache global template vars before we switch to the // force SSViewer_DataPresenter to cache global template vars before we switch to the
// test-project class manifest (since it will lose visibility of core classes) // test-project class manifest (since it will lose visibility of core classes)
$presenter = new SSViewer_DataPresenter(new ViewableData()); $presenter = new SSViewer_DataPresenter(new ModelData());
unset($presenter); unset($presenter);
// Switch to test manifest // Switch to test manifest