From 37efc3a8bed1806df929aae4e288f2f9c7a1d49a Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 12 Sep 2024 11:17:03 +1200 Subject: [PATCH] API Move various classes to more appropriate namespaces Also rename ViewableData to ModelData ahead of the template layer lift-and-shift --- composer.json | 2 + src/Control/Controller.php | 2 +- src/Control/Email/Email.php | 14 +- src/Control/HTTPRequest.php | 2 +- src/Control/RSS/RSSFeed.php | 8 +- src/Control/RSS/RSSFeed_Entry.php | 6 +- src/Control/RequestHandler.php | 10 +- src/{ORM => Core}/ArrayLib.php | 4 +- src/Core/ClassInfo.php | 4 +- src/Core/Convert.php | 2 +- src/Core/Extensible.php | 4 +- src/Core/Validation/ConstraintValidator.php | 2 +- .../Validation}/ValidationException.php | 2 +- .../Validation}/ValidationResult.php | 2 +- src/Dev/BulkLoader.php | 4 +- src/Dev/BulkLoader_Result.php | 4 +- ...DataContains.php => ModelDataContains.php} | 10 +- src/Dev/Constraint/SSListContains.php | 8 +- src/Dev/Constraint/SSListContainsOnly.php | 2 +- .../SSListContainsOnlyMatchingItems.php | 6 +- src/Dev/SSListExporter.php | 10 +- src/Dev/SapphireTest.php | 2 +- src/Dev/TaskRunner.php | 8 +- src/Forms/CheckboxSetField.php | 4 +- src/Forms/CompositeValidator.php | 2 +- src/Forms/DateField.php | 2 +- src/Forms/DatetimeField.php | 2 +- src/Forms/DropdownField.php | 4 +- src/Forms/FieldGroup.php | 2 +- src/Forms/FieldList.php | 2 +- src/Forms/FileUploadReceiver.php | 6 +- src/Forms/Form.php | 16 +-- src/Forms/FormField.php | 12 +- src/Forms/FormMessage.php | 6 +- src/Forms/FormRequestHandler.php | 6 +- src/Forms/Form_FieldMap.php | 4 +- src/Forms/GridField/GridField.php | 26 ++-- .../GridFieldAddExistingAutocompleter.php | 4 +- src/Forms/GridField/GridFieldAddNewButton.php | 2 +- src/Forms/GridField/GridFieldButtonRow.php | 2 +- src/Forms/GridField/GridFieldConfig.php | 2 +- src/Forms/GridField/GridFieldDataColumns.php | 10 +- src/Forms/GridField/GridFieldDeleteAction.php | 14 +- src/Forms/GridField/GridFieldDetailForm.php | 8 +- .../GridFieldDetailForm_ItemRequest.php | 22 ++-- src/Forms/GridField/GridFieldEditButton.php | 8 +- src/Forms/GridField/GridFieldExportButton.php | 6 +- src/Forms/GridField/GridFieldFilterHeader.php | 6 +- src/Forms/GridField/GridFieldFooter.php | 2 +- .../GridField/GridFieldGroupDeleteAction.php | 2 +- src/Forms/GridField/GridFieldImportButton.php | 2 +- src/Forms/GridField/GridFieldLazyLoader.php | 6 +- src/Forms/GridField/GridFieldLevelup.php | 2 +- src/Forms/GridField/GridFieldPaginator.php | 6 +- src/Forms/GridField/GridFieldPrintButton.php | 8 +- .../GridField/GridFieldSortableHeader.php | 8 +- src/Forms/GridField/GridFieldViewButton.php | 2 +- src/Forms/GridField/GridField_ActionMenu.php | 2 +- .../GridField/GridField_ActionMenuItem.php | 8 +- .../GridField/GridField_ActionMenuLink.php | 4 +- .../GridField/GridField_ColumnProvider.php | 4 +- .../GridField/GridField_DataManipulator.php | 2 +- src/Forms/GridField/GridField_SaveHandler.php | 4 +- src/Forms/GroupedDropdownField.php | 6 +- src/Forms/ListboxField.php | 4 +- src/Forms/LiteralField.php | 4 +- src/Forms/LookupField.php | 2 +- src/Forms/MoneyField.php | 2 +- src/Forms/OptionsetField.php | 4 +- src/Forms/RequiredFields.php | 2 +- src/Forms/Schema/FormSchema.php | 2 +- src/Forms/SearchableDropdownTrait.php | 6 +- src/Forms/SearchableLookupField.php | 4 +- src/Forms/SelectField.php | 4 +- src/Forms/SelectionGroup.php | 2 +- src/Forms/SingleLookupField.php | 2 +- src/Forms/TreeMultiselectField.php | 8 +- src/Forms/Validator.php | 2 +- src/{View => Model}/ArrayData.php | 12 +- src/{ORM => Model/List}/ArrayList.php | 14 +- src/{ORM => Model/List}/Filterable.php | 2 +- src/{ORM => Model/List}/GroupedList.php | 4 +- src/{ORM => Model/List}/Limitable.php | 2 +- src/{ORM => Model/List}/ListDecorator.php | 6 +- src/{ORM => Model/List}/Map.php | 2 +- src/{ORM => Model/List}/PaginatedList.php | 4 +- src/{ORM => Model/List}/SS_List.php | 2 +- src/{ORM => Model/List}/Sortable.php | 2 +- .../ViewableData.php => Model/ModelData.php} | 85 ++++++------ .../ModelDataCustomised.php} | 12 +- .../ModelDataDebugger.php} | 12 +- src/ORM/Connect/DBQueryBuilder.php | 4 +- src/ORM/Connect/Database.php | 2 +- src/ORM/Connect/MySQLDatabase.php | 4 +- src/ORM/DataList.php | 8 +- src/ORM/DataObject.php | 10 +- src/ORM/EagerLoadedList.php | 4 +- src/ORM/FieldType/DBBoolean.php | 4 +- src/ORM/FieldType/DBClassName.php | 4 +- src/ORM/FieldType/DBComposite.php | 12 +- src/ORM/FieldType/DBCurrency.php | 4 +- src/ORM/FieldType/DBDate.php | 4 +- src/ORM/FieldType/DBDatetime.php | 4 +- src/ORM/FieldType/DBDecimal.php | 4 +- src/ORM/FieldType/DBEnum.php | 2 +- src/ORM/FieldType/DBField.php | 10 +- src/ORM/FieldType/DBForeignKey.php | 4 +- src/ORM/FieldType/DBInt.php | 6 +- src/ORM/FieldType/DBPercentage.php | 4 +- src/ORM/FieldType/DBPolymorphicForeignKey.php | 4 +- src/ORM/FieldType/DBPrimaryKey.php | 4 +- src/ORM/FieldType/DBTime.php | 4 +- src/ORM/Hierarchy/Hierarchy.php | 10 +- src/ORM/Hierarchy/MarkedSet.php | 8 +- src/ORM/RelatedData/RelatedDataService.php | 2 +- .../StandardRelatedDataService.php | 4 +- src/ORM/Search/BasicSearchContext.php | 6 +- src/ORM/Search/SearchContext.php | 4 +- src/Security/AuthenticationHandler.php | 2 +- src/Security/AuthenticationMiddleware.php | 2 +- src/Security/Authenticator.php | 2 +- src/Security/Confirmation/Form.php | 2 +- src/Security/Group.php | 2 +- src/Security/Member.php | 10 +- .../CMSMemberAuthenticator.php | 2 +- .../ChangePasswordHandler.php | 2 +- .../MemberAuthenticator/LoginHandler.php | 2 +- .../MemberAuthenticator/LogoutHandler.php | 2 +- .../MemberAuthenticator.php | 2 +- .../MemberAuthenticator/MemberLoginForm.php | 2 +- src/Security/PasswordValidator.php | 2 +- src/Security/Permission.php | 6 +- src/Security/PermissionCheckboxSetField.php | 4 +- src/Security/Security.php | 6 +- src/View/AttributesHTML.php | 2 +- src/View/Parsers/HTMLValue.php | 4 +- src/View/SSTemplateParser.peg | 2 +- src/View/SSTemplateParser.php | 20 +-- src/View/SSViewer.php | 12 +- src/View/SSViewer_BasicIteratorSupport.php | 2 +- src/View/SSViewer_DataPresenter.php | 6 +- src/View/SSViewer_Scope.php | 6 +- .../Shortcodes/EmbedShortcodeProvider.php | 4 +- src/View/TemplateGlobalProvider.php | 2 +- src/View/TemplateIteratorProvider.php | 2 +- tests/php/Control/Email/EmailTest.php | 10 +- tests/php/Control/RSS/RSSFeedTest.php | 2 +- tests/php/Control/RSS/RSSFeedTest/ItemA.php | 4 +- tests/php/Control/RSS/RSSFeedTest/ItemB.php | 4 +- tests/php/Control/RSS/RSSFeedTest/ItemC.php | 4 +- tests/php/Control/RSS/RSSFeedTest/ItemD.php | 4 +- .../ControllerFailover.php | 4 +- tests/php/{ORM => Core}/ArrayLibTest.php | 2 +- tests/php/Core/ClassInfoTest.php | 4 +- .../InjectorTest/TestSetterInjections.php | 6 +- .../Validation}/ValidationExceptionTest.php | 6 +- .../Validation}/ValidationResultTest.php | 4 +- .../SSListContainsOnlyMatchingItemsTest.php | 2 +- tests/php/Dev/SSListContainsOnlyTest.php | 2 +- tests/php/Dev/SSListContainsTest.php | 2 +- tests/php/Dev/SSListExporterTest.php | 4 +- tests/php/Dev/SapphireTestTest.php | 2 +- tests/php/Dev/ViewableDataContainsTest.php | 20 +-- .../ViewableDataContainsTest/TestObject.php | 6 +- tests/php/Forms/CheckboxSetFieldTest.php | 4 +- tests/php/Forms/DropdownFieldTest.php | 8 +- .../Forms/EmailFieldTest/TestValidator.php | 2 +- tests/php/Forms/EnumFieldTest.php | 2 +- tests/php/Forms/FormFieldTest.php | 2 +- tests/php/Forms/FormTest.php | 8 +- ...trollerWithSpecialSubmittedValueFields.php | 4 +- tests/php/Forms/FormTest/TestController.php | 4 +- .../GridField/GridFieldActionMenuTest.php | 2 +- .../GridFieldAddExistingAutocompleterTest.php | 4 +- .../GridField/GridFieldAddNewButtonTest.php | 6 +- .../Forms/GridField/GridFieldConfigTest.php | 2 +- .../GridField/GridFieldDataColumnsTest.php | 4 +- .../GridField/GridFieldDeleteActionTest.php | 6 +- .../GridField/GridFieldDetailFormTest.php | 4 +- .../ArrayDataWithID.php | 2 +- .../TestController.php | 2 +- .../GridFieldDetailForm_ItemRequestTest.php | 4 +- .../GridField/GridFieldEditButtonTest.php | 2 +- .../GridField/GridFieldExportButtonTest.php | 4 +- .../GridField/GridFieldFilterHeaderTest.php | 4 +- .../NonDataObject.php | 2 +- .../GridField/GridFieldLazyLoaderTest.php | 2 +- .../Forms/GridField/GridFieldLevelupTest.php | 2 +- .../GridField/GridFieldPaginatorTest.php | 2 +- .../GridField/GridFieldPrintButtonTest.php | 4 +- .../GridField/GridFieldStateManagerTest.php | 2 +- tests/php/Forms/GridField/GridFieldTest.php | 4 +- .../GridField/GridFieldTest/Component2.php | 4 +- .../TestController.php | 2 +- tests/php/Forms/ListboxFieldTest.php | 2 +- tests/php/{View => Model}/ArrayDataTest.php | 10 +- .../ArrayDataTest/NonEmptyObject.php | 2 +- .../php/{ORM => Model/List}/ArrayListTest.php | 8 +- .../List}/ArrayListTest/TestObject.php | 2 +- .../{ORM => Model/List}/GroupedListTest.php | 8 +- .../{ORM => Model/List}/ListDecoratorTest.php | 8 +- tests/php/{ORM => Model/List}/MapTest.php | 20 ++- tests/php/Model/List/MapTest.yml | 32 +++++ tests/php/Model/List/MapTest/SubTeam.php | 14 ++ tests/php/Model/List/MapTest/Team.php | 39 ++++++ tests/php/Model/List/MapTest/TeamComment.php | 22 ++++ .../{ORM => Model/List}/PaginatedListTest.php | 22 ++-- tests/php/Model/List/PaginatedListTest.yml | 13 ++ .../Model/List/PaginatedListTest/Player.php | 21 +++ tests/php/Model/ModelDataCustomisedTest.php | 55 ++++++++ .../ModelDataTest.php} | 121 +++++++++--------- tests/php/Model/ModelDataTest/Cached.php | 11 ++ .../ModelDataTest}/Castable.php | 6 +- .../ModelDataTest}/Caster.php | 6 +- .../ModelDataTest}/CastingClass.php | 6 +- tests/php/Model/ModelDataTest/Container.php | 11 ++ tests/php/Model/ModelDataTest/Failover.php | 13 ++ .../ModelDataTest/NoCastingInformation.php | 14 ++ .../ModelDataTest}/NotCached.php | 6 +- .../ModelDataTest}/RequiresCasting.php | 6 +- .../ModelDataTest}/UnescapedCaster.php | 6 +- .../ModelDataTest}/ViewableDataTestObject.php | 4 +- .../ViewableDataTextExtension.php | 4 +- .../ModelDataTest}/testtheme/empty.txt | 0 tests/php/ORM/DBFieldTest/TestDbField.php | 4 +- tests/php/ORM/DataListEagerLoadingTest.php | 2 +- tests/php/ORM/DataListTest.php | 2 +- tests/php/ORM/DataObjectTest.php | 6 +- .../ORM/DataObjectTest/ValidatedObject.php | 2 +- tests/php/ORM/DataQueryTest.php | 2 +- tests/php/ORM/EagerLoadedListTest.php | 2 +- tests/php/ORM/Filters/EndsWithFilterTest.php | 2 +- .../php/ORM/Filters/ExactMatchFilterTest.php | 2 +- .../php/ORM/Filters/GreaterThanFilterTest.php | 2 +- .../Filters/GreaterThanOrEqualFilterTest.php | 2 +- tests/php/ORM/Filters/LessThanFilterTest.php | 2 +- .../ORM/Filters/LessThanOrEqualFilterTest.php | 2 +- .../ORM/Filters/PartialMatchFilterTest.php | 2 +- .../php/ORM/Filters/StartsWithFilterTest.php | 2 +- tests/php/ORM/HierarchyTest.php | 2 +- tests/php/ORM/RelatedDataServiceTest.php | 2 +- tests/php/ORM/SQLSelectTest.php | 2 +- .../php/ORM/Search/BasicSearchContextTest.php | 4 +- tests/php/ORM/Search/SearchContextTest.php | 2 +- tests/php/Security/GroupTest.php | 2 +- .../php/Security/MemberAuthenticatorTest.php | 2 +- tests/php/Security/MemberTest.php | 6 +- .../ExtendedChangePasswordExtension.php | 2 +- .../VerySpecificPasswordValidator.php | 2 +- .../PasswordExpirationMiddlewareTest.php | 2 +- tests/php/Security/SecurityTest.php | 2 +- .../VersionedMemberAuthenticatorTest.php | 2 +- tests/php/View/RequirementsTest.php | 2 +- tests/php/View/SSViewerCacheBlockTest.php | 2 +- tests/php/View/SSViewerTest.php | 40 +++--- tests/php/View/SSViewerTest/CacheTestData.php | 8 +- tests/php/View/SSViewerTest/LevelTestData.php | 6 +- tests/php/View/SSViewerTest/TestFixture.php | 8 +- .../View/SSViewerTest/TestViewableData.php | 4 +- tests/php/View/ViewableDataCustomisedTest.php | 55 -------- tests/php/View/ViewableDataTest/Cached.php | 11 -- tests/php/View/ViewableDataTest/Container.php | 11 -- tests/php/View/ViewableDataTest/Failover.php | 13 -- .../ViewableDataTest/NoCastingInformation.php | 14 -- tests/php/i18n/i18nTest.php | 2 +- tests/php/i18n/i18nTestManifest.php | 4 +- 266 files changed, 947 insertions(+), 812 deletions(-) rename src/{ORM => Core}/ArrayLib.php (98%) rename src/{ORM => Core/Validation}/ValidationException.php (98%) rename src/{ORM => Core/Validation}/ValidationResult.php (99%) rename src/Dev/Constraint/{ViewableDataContains.php => ModelDataContains.php} (85%) rename src/{View => Model}/ArrayData.php (91%) rename src/{ORM => Model/List}/ArrayList.php (98%) rename src/{ORM => Model/List}/Filterable.php (99%) rename src/{ORM => Model/List}/GroupedList.php (95%) rename src/{ORM => Model/List}/Limitable.php (96%) rename src/{ORM => Model/List}/ListDecorator.php (97%) rename src/{ORM => Model/List}/Map.php (99%) rename src/{ORM => Model/List}/PaginatedList.php (99%) rename src/{ORM => Model/List}/SS_List.php (98%) rename src/{ORM => Model/List}/Sortable.php (97%) rename src/{View/ViewableData.php => Model/ModelData.php} (87%) rename src/{View/ViewableData_Customised.php => Model/ModelDataCustomised.php} (87%) rename src/{View/ViewableData_Debugger.php => Model/ModelDataDebugger.php} (86%) rename tests/php/{ORM => Core}/ArrayLibTest.php (99%) rename tests/php/{ORM => Core/Validation}/ValidationExceptionTest.php (98%) rename tests/php/{ORM => Core/Validation}/ValidationResultTest.php (91%) rename tests/php/{View => Model}/ArrayDataTest.php (89%) rename tests/php/{View => Model}/ArrayDataTest/NonEmptyObject.php (83%) rename tests/php/{ORM => Model/List}/ArrayListTest.php (99%) rename tests/php/{ORM => Model/List}/ArrayListTest/TestObject.php (84%) rename tests/php/{ORM => Model/List}/GroupedListTest.php (97%) rename tests/php/{ORM => Model/List}/ListDecoratorTest.php (98%) rename tests/php/{ORM => Model/List}/MapTest.php (96%) create mode 100644 tests/php/Model/List/MapTest.yml create mode 100644 tests/php/Model/List/MapTest/SubTeam.php create mode 100644 tests/php/Model/List/MapTest/Team.php create mode 100644 tests/php/Model/List/MapTest/TeamComment.php rename tests/php/{ORM => Model/List}/PaginatedListTest.php (97%) create mode 100644 tests/php/Model/List/PaginatedListTest.yml create mode 100644 tests/php/Model/List/PaginatedListTest/Player.php create mode 100644 tests/php/Model/ModelDataCustomisedTest.php rename tests/php/{View/ViewableDataTest.php => Model/ModelDataTest.php} (70%) create mode 100644 tests/php/Model/ModelDataTest/Cached.php rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/Castable.php (86%) rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/Caster.php (54%) rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/CastingClass.php (60%) create mode 100644 tests/php/Model/ModelDataTest/Container.php create mode 100644 tests/php/Model/ModelDataTest/Failover.php create mode 100644 tests/php/Model/ModelDataTest/NoCastingInformation.php rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/NotCached.php (53%) rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/RequiresCasting.php (57%) rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/UnescapedCaster.php (64%) rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/ViewableDataTestObject.php (81%) rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/ViewableDataTextExtension.php (76%) rename tests/php/{View/ViewableDataTest => Model/ModelDataTest}/testtheme/empty.txt (100%) delete mode 100644 tests/php/View/ViewableDataCustomisedTest.php delete mode 100644 tests/php/View/ViewableDataTest/Cached.php delete mode 100644 tests/php/View/ViewableDataTest/Container.php delete mode 100644 tests/php/View/ViewableDataTest/Failover.php delete mode 100644 tests/php/View/ViewableDataTest/NoCastingInformation.php diff --git a/composer.json b/composer.json index b25ea980d90..8871483b369 100644 --- a/composer.json +++ b/composer.json @@ -96,6 +96,8 @@ "SilverStripe\\i18n\\Tests\\": "tests/php/i18n/", "SilverStripe\\Logging\\": "src/Logging/", "SilverStripe\\Logging\\Tests\\": "tests/php/Logging/", + "SilverStripe\\Model\\": "src/Model/", + "SilverStripe\\Model\\Tests\\": "tests/php/Model/", "SilverStripe\\ORM\\": "src/ORM/", "SilverStripe\\ORM\\Tests\\": "tests/php/ORM/", "SilverStripe\\Security\\": "src/Security/", diff --git a/src/Control/Controller.php b/src/Control/Controller.php index 299ce72a7f4..d1abe672f0b 100644 --- a/src/Control/Controller.php +++ b/src/Control/Controller.php @@ -230,7 +230,7 @@ protected function prepareResponse($response) } $this->setResponse($response); } else { - // Could be Controller, or ViewableData_Customised controller wrapper + // Could be Controller, or ModelDataCustomised controller wrapper if (ClassInfo::hasMethod($response, 'getViewer')) { if (isset($_REQUEST['debug_request'])) { $class = static::class; diff --git a/src/Control/Email/Email.php b/src/Control/Email/Email.php index 52b05dc944f..e7413e10ac3 100644 --- a/src/Control/Email/Email.php +++ b/src/Control/Email/Email.php @@ -13,11 +13,11 @@ use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; use SilverStripe\View\ThemeResourceLoader; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Email as SymfonyEmail; @@ -56,9 +56,9 @@ class Email extends SymfonyEmail /** * Additional data available in a template. - * Used in the same way than {@link ViewableData->customize()}. + * Used in the same way than {@link ModelData->customize()}. */ - private ViewableData $data; + private ModelData $data; private bool $dataHasBeenSet = false; @@ -194,7 +194,7 @@ public function __construct( if ($returnPath) { $this->setReturnPath($returnPath); } - $this->data = ViewableData::create(); + $this->data = ModelData::create(); } private function getDefaultFrom(): string|array @@ -336,7 +336,7 @@ public function addAttachmentFromData(string $data, string $name, string $mime = * IsEmail: used to detect if rendering an email template rather than a page template * BaseUrl: used to get the base URL for the email */ - public function getData(): ViewableData + public function getData(): ModelData { $extraData = [ 'IsEmail' => true, @@ -357,7 +357,7 @@ public function getData(): ViewableData * * Calling setData() once means that any content set via text()/html()/setBody() will have no effect */ - public function setData(array|ViewableData $data) + public function setData(array|ModelData $data) { if (is_array($data)) { $data = ArrayData::create($data); diff --git a/src/Control/HTTPRequest.php b/src/Control/HTTPRequest.php index ee014d0fdb0..160e450d307 100644 --- a/src/Control/HTTPRequest.php +++ b/src/Control/HTTPRequest.php @@ -6,7 +6,7 @@ use BadMethodCallException; use InvalidArgumentException; use SilverStripe\Core\ClassInfo; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; /** * Represents a HTTP-request, including a URL that is tokenised for parsing, and a request method diff --git a/src/Control/RSS/RSSFeed.php b/src/Control/RSS/RSSFeed.php index c397f545457..d07819c3051 100644 --- a/src/Control/RSS/RSSFeed.php +++ b/src/Control/RSS/RSSFeed.php @@ -3,8 +3,8 @@ namespace SilverStripe\Control\RSS; use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\Core\Convert; use SilverStripe\Control\Director; @@ -12,14 +12,14 @@ use SilverStripe\Control\HTTP; use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * RSSFeed class * * This class is used to create an RSS feed. */ -class RSSFeed extends ViewableData +class RSSFeed extends ModelData { /** diff --git a/src/Control/RSS/RSSFeed_Entry.php b/src/Control/RSS/RSSFeed_Entry.php index ff6da977f43..1ebaae7e7de 100644 --- a/src/Control/RSS/RSSFeed_Entry.php +++ b/src/Control/RSS/RSSFeed_Entry.php @@ -5,7 +5,7 @@ use SilverStripe\Control\Director; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use BadMethodCallException; /** @@ -15,7 +15,7 @@ * * @see RSSFeed */ -class RSSFeed_Entry extends ViewableData +class RSSFeed_Entry extends ModelData { /** * Name of the title field of feed entries @@ -40,7 +40,7 @@ class RSSFeed_Entry extends ViewableData /** * Create a new RSSFeed entry. - * @param ViewableData $entry + * @param ModelData $entry * @param string $titleField * @param string $descriptionField * @param string $authorField diff --git a/src/Control/RequestHandler.php b/src/Control/RequestHandler.php index 4c2ee1b23df..ba1f1d9aac4 100644 --- a/src/Control/RequestHandler.php +++ b/src/Control/RequestHandler.php @@ -13,7 +13,7 @@ use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionFailureException; use SilverStripe\Security\Security; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * This class is the base class of any SilverStripe object that can be used to handle HTTP requests. @@ -45,7 +45,7 @@ * * {@link RequestHandler::handleRequest()} is where this behaviour is implemented. */ -class RequestHandler extends ViewableData +class RequestHandler extends ModelData { /** @@ -130,7 +130,7 @@ public function __construct() /** * Handles URL requests. * - * - ViewableData::handleRequest() iterates through each rule in {@link RequestHandler::$url_handlers}. + * - ModelData::handleRequest() iterates through each rule in {@link RequestHandler::$url_handlers}. * - If the rule matches, the named method will be called. * - If there is still more URL to be processed, then handleRequest() * is called on the object that that method returns. @@ -248,8 +248,8 @@ protected function findAction($request) { $handlerClass = static::class; - // We stop after RequestHandler; in other words, at ViewableData - while ($handlerClass && $handlerClass != ViewableData::class) { + // We stop after RequestHandler; in other words, at ModelData + while ($handlerClass && $handlerClass != ModelData::class) { $urlHandlers = Config::inst()->get($handlerClass, 'url_handlers', Config::UNINHERITED); if ($urlHandlers) { diff --git a/src/ORM/ArrayLib.php b/src/Core/ArrayLib.php similarity index 98% rename from src/ORM/ArrayLib.php rename to src/Core/ArrayLib.php index 371d0f6dfca..50aa8bb3bcf 100644 --- a/src/ORM/ArrayLib.php +++ b/src/Core/ArrayLib.php @@ -1,6 +1,6 @@ @silverstripe.com) */ -abstract class BulkLoader extends ViewableData +abstract class BulkLoader extends ModelData { private bool $checkPermissions = false; diff --git a/src/Dev/BulkLoader_Result.php b/src/Dev/BulkLoader_Result.php index be1b1251602..0c1071552a0 100644 --- a/src/Dev/BulkLoader_Result.php +++ b/src/Dev/BulkLoader_Result.php @@ -3,9 +3,9 @@ namespace SilverStripe\Dev; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; /** * Encapsulates the result of a {@link BulkLoader} import diff --git a/src/Dev/Constraint/ViewableDataContains.php b/src/Dev/Constraint/ModelDataContains.php similarity index 85% rename from src/Dev/Constraint/ViewableDataContains.php rename to src/Dev/Constraint/ModelDataContains.php index 97bc26e50fe..fa7f839c256 100644 --- a/src/Dev/Constraint/ViewableDataContains.php +++ b/src/Dev/Constraint/ModelDataContains.php @@ -5,14 +5,14 @@ use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use SilverStripe\Dev\SapphireTest; /** - * Constraint for checking if a ViewableData (e.g. ArrayData or any DataObject) contains fields matching the given + * Constraint for checking if a ModelData (e.g. ArrayData or any DataObject) contains fields matching the given * key-value pairs. */ -class ViewableDataContains extends Constraint implements TestOnly +class ModelDataContains extends Constraint implements TestOnly { /** * @var array @@ -20,7 +20,7 @@ class ViewableDataContains extends Constraint implements TestOnly private $match; /** - * ViewableDataContains constructor. + * ModelDataContains constructor. */ public function __construct(array $match) { @@ -44,7 +44,7 @@ public function __construct(array $match) * a boolean value instead: true in case of success, false in case of a * failure. * - * @param ViewableData $other Value or object to evaluate. + * @param ModelData $other Value or object to evaluate. * @param string $description Additional information about the test * @param bool $returnResult Whether to return a result or throw an exception * diff --git a/src/Dev/Constraint/SSListContains.php b/src/Dev/Constraint/SSListContains.php index e9880ee22b6..7e733fbae1f 100644 --- a/src/Dev/Constraint/SSListContains.php +++ b/src/Dev/Constraint/SSListContains.php @@ -6,8 +6,8 @@ use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\SSListExporter; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\ModelData; /** * Constraint for checking if a SS_List contains items matching the given @@ -77,11 +77,11 @@ public function evaluate($other, $description = '', $returnResult = false): ?boo return null; } - protected function checkIfItemEvaluatesRemainingMatches(ViewableData $item): bool + protected function checkIfItemEvaluatesRemainingMatches(ModelData $item): bool { $success = false; foreach ($this->matches as $key => $match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); if ($constraint->evaluate($item, '', true)) { $success = true; diff --git a/src/Dev/Constraint/SSListContainsOnly.php b/src/Dev/Constraint/SSListContainsOnly.php index f7fdef978f5..4221c2225e0 100644 --- a/src/Dev/Constraint/SSListContainsOnly.php +++ b/src/Dev/Constraint/SSListContainsOnly.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; /** * Constraint for checking if a SS_List contains only items matching the given diff --git a/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php b/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php index a08b20f53cb..7a5a42678ff 100644 --- a/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php +++ b/src/Dev/Constraint/SSListContainsOnlyMatchingItems.php @@ -6,7 +6,7 @@ use PHPUnit\Framework\ExpectationFailedException; use SilverStripe\Dev\SSListExporter; 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, @@ -22,7 +22,7 @@ class SSListContainsOnlyMatchingItems extends Constraint implements TestOnly protected SSListExporter $exporter; /** - * @var ViewableDataContains + * @var ModelDataContains */ private $constraint; @@ -30,7 +30,7 @@ public function __construct($match) { $this->exporter = new SSListExporter(); - $this->constraint = new ViewableDataContains($match); + $this->constraint = new ModelDataContains($match); $this->match = $match; } diff --git a/src/Dev/SSListExporter.php b/src/Dev/SSListExporter.php index 96293162f1d..b518ceac06f 100644 --- a/src/Dev/SSListExporter.php +++ b/src/Dev/SSListExporter.php @@ -4,8 +4,8 @@ use SebastianBergmann\Exporter\Exporter; use SebastianBergmann\RecursionContext\Context; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\ModelData; if (!class_exists(Exporter::class)) { return; @@ -56,7 +56,7 @@ protected function recursiveExport(&$value, $indentation, $processed = null) return sprintf($className . ' &%s (%s)', $key, $values); } - if ($value instanceof ViewableData) { + if ($value instanceof ModelData) { $className = get_class($value); $data = $this->toMap($value); @@ -73,10 +73,10 @@ protected function recursiveExport(&$value, $indentation, $processed = null) } /** - * @param ViewableData $object + * @param ModelData $object * @return array */ - public function toMap(ViewableData $object) + public function toMap(ModelData $object) { return $object->hasMethod('toMap') ? $object->toMap() diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index b54a58e5554..daa45f38f43 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -31,7 +31,7 @@ use SilverStripe\ORM\Connect\TempDatabase; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\Security\Group; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\Member; diff --git a/src/Dev/TaskRunner.php b/src/Dev/TaskRunner.php index ecd87c1a26b..dec9997cabe 100644 --- a/src/Dev/TaskRunner.php +++ b/src/Dev/TaskRunner.php @@ -11,12 +11,12 @@ use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Manifest\ModuleResourceLoader; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionProvider; use SilverStripe\Security\Security; -use SilverStripe\View\ArrayData; -use SilverStripe\View\ViewableData; +use Silverstripe\Model\ArrayData; +use SilverStripe\Model\ModelData; class TaskRunner extends Controller implements PermissionProvider { @@ -92,7 +92,7 @@ public function index() 'Info' => $renderer->renderInfo('SilverStripe Development Tools: Tasks', $baseUrl), ]; - return ViewableData::create()->renderWith(static::class, $data); + return ModelData::create()->renderWith(static::class, $data); } /** diff --git a/src/Forms/CheckboxSetField.php b/src/Forms/CheckboxSetField.php index 786d5f6e456..678f8dd2dbb 100644 --- a/src/Forms/CheckboxSetField.php +++ b/src/Forms/CheckboxSetField.php @@ -3,10 +3,10 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\View\Requirements; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; /** * Displays a set of checkboxes as a logical group. diff --git a/src/Forms/CompositeValidator.php b/src/Forms/CompositeValidator.php index f625360488b..cc4c508c1a7 100644 --- a/src/Forms/CompositeValidator.php +++ b/src/Forms/CompositeValidator.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * CompositeValidator can contain between 0 and many different types of Validators. Each Validator is itself still diff --git a/src/Forms/DateField.php b/src/Forms/DateField.php index 880fa0827aa..5649f8039e1 100644 --- a/src/Forms/DateField.php +++ b/src/Forms/DateField.php @@ -7,7 +7,7 @@ use InvalidArgumentException; use SilverStripe\ORM\FieldType\DBDate; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Form used for editing a date string diff --git a/src/Forms/DatetimeField.php b/src/Forms/DatetimeField.php index 849a0ecb834..c822dbf7b42 100644 --- a/src/Forms/DatetimeField.php +++ b/src/Forms/DatetimeField.php @@ -7,7 +7,7 @@ use SilverStripe\i18n\i18n; use SilverStripe\ORM\FieldType\DBDate; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Form field used for editing date time strings. diff --git a/src/Forms/DropdownField.php b/src/Forms/DropdownField.php index 86a2abf25db..829b5ac516c 100644 --- a/src/Forms/DropdownField.php +++ b/src/Forms/DropdownField.php @@ -2,8 +2,8 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; /** * Dropdown field, created from a select tag. diff --git a/src/Forms/FieldGroup.php b/src/Forms/FieldGroup.php index 46099ab1d1d..9a0d6c67588 100644 --- a/src/Forms/FieldGroup.php +++ b/src/Forms/FieldGroup.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Lets you include a nested group of fields inside a template. diff --git a/src/Forms/FieldList.php b/src/Forms/FieldList.php index a7898f2f23f..d0dc54ac822 100644 --- a/src/Forms/FieldList.php +++ b/src/Forms/FieldList.php @@ -6,7 +6,7 @@ use RuntimeException; use SilverStripe\Forms\Tab; use SilverStripe\Forms\TabSet; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Dev\Deprecation; /** diff --git a/src/Forms/FileUploadReceiver.php b/src/Forms/FileUploadReceiver.php index 19ed57d23ac..3aaa42ff323 100644 --- a/src/Forms/FileUploadReceiver.php +++ b/src/Forms/FileUploadReceiver.php @@ -7,13 +7,13 @@ use SilverStripe\Assets\File; use SilverStripe\Assets\Storage\AssetContainer; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\RelationList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\UnsavedRelationList; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; /** * Provides operations for reading and writing uploaded files to/from diff --git a/src/Forms/Form.php b/src/Forms/Form.php index 7719193bdaf..7ce206f8d57 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -14,12 +14,12 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\NullSecurityToken; use SilverStripe\Security\SecurityToken; use SilverStripe\View\AttributesHTML; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Base class for all forms. @@ -62,7 +62,7 @@ * For example, the "URLSegment" field in a standard CMS form would be * accessible through "admin/EditForm/field/URLSegment/FieldHolder". */ -class Form extends ViewableData implements HasRequestHandler +class Form extends ModelData implements HasRequestHandler { use AttributesHTML; use FormMessage; @@ -135,7 +135,7 @@ class Form extends ViewableData implements HasRequestHandler /** * Populated by {@link loadDataFrom()}. * - * @var ViewableData|null + * @var ModelData|null */ protected $record; @@ -1225,7 +1225,7 @@ public function sessionFieldError($message, $fieldName, $type = ValidationResult * Returns the record that has given this form its data * through {@link loadDataFrom()}. * - * @return ViewableData + * @return ModelData */ public function getRecord() { @@ -1305,7 +1305,7 @@ public function validationResult() * @uses FormField::setSubmittedValue() * @uses FormField::setValue() * - * @param array|ViewableData $data + * @param array|ModelData $data * @param int $mergeStrategy * For every field, {@link $data} is interrogated whether it contains a relevant property/key, and * what that property/key's value is. @@ -1402,7 +1402,7 @@ public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) // There's no other way to tell whether the relation actually exists $exists = false; } - // Regular ViewableData access + // Regular ModelData access } else { $exists = ( isset($data->$name) || @@ -1478,7 +1478,7 @@ public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) * Save the contents of this form into the given data object. * It will make use of setCastedField() to do this. * - * @param ViewableData&DataObjectInterface $dataObject The object to save data into + * @param ModelData&DataObjectInterface $dataObject The object to save data into * @param array|null $fieldList An optional list of fields to process. This can be useful when you have a * form that has some fields that save to one object, and some that save to another. */ diff --git a/src/Forms/FormField.php b/src/Forms/FormField.php index fe31dc6add2..0d210436b0f 100644 --- a/src/Forms/FormField.php +++ b/src/Forms/FormField.php @@ -11,10 +11,10 @@ use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\View\AttributesHTML; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a field in a form. @@ -325,7 +325,7 @@ public static function name_to_label($fieldName) * Creates a new field. * * @param string $name The internal field name, passed to forms. - * @param null|string|\SilverStripe\View\ViewableData $title The human-readable field label. + * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. * @param mixed $value The value of the field. */ public function __construct($name, $title = null, $value = null) @@ -458,7 +458,7 @@ public function Value() * * By default, makes use of $this->dataValue() * - * @param ViewableData|DataObjectInterface $record Record to save data into + * @param ModelData|DataObjectInterface $record Record to save data into */ public function saveInto(DataObjectInterface $record) { @@ -697,7 +697,7 @@ public function attrValue() * or a submitted form value they should override setSubmittedValue() instead. * * @param mixed $value Either the parent object, or array of source data being loaded - * @param array|ViewableData $data {@see Form::loadDataFrom} + * @param array|ModelData $data {@see Form::loadDataFrom} * @return $this */ public function setValue($value, $data = null) @@ -712,7 +712,7 @@ public function setValue($value, $data = null) * data formats. * * @param mixed $value - * @param array|ViewableData $data + * @param array|ModelData $data * @return $this */ public function setSubmittedValue($value, $data = null) diff --git a/src/Forms/FormMessage.php b/src/Forms/FormMessage.php index ce18ee153a6..2ac83c9fd33 100644 --- a/src/Forms/FormMessage.php +++ b/src/Forms/FormMessage.php @@ -3,13 +3,13 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\View\ViewableData; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\ModelData; /** * Form component which contains a castable message * - * @mixin ViewableData + * @mixin ModelData */ trait FormMessage { diff --git a/src/Forms/FormRequestHandler.php b/src/Forms/FormRequestHandler.php index f2426280325..d2125881116 100644 --- a/src/Forms/FormRequestHandler.php +++ b/src/Forms/FormRequestHandler.php @@ -11,9 +11,9 @@ use SilverStripe\Control\RequestHandler; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Core\Validation\ValidationException; class FormRequestHandler extends RequestHandler { diff --git a/src/Forms/Form_FieldMap.php b/src/Forms/Form_FieldMap.php index ddf03dc3492..093bbab11b2 100644 --- a/src/Forms/Form_FieldMap.php +++ b/src/Forms/Form_FieldMap.php @@ -2,9 +2,9 @@ namespace SilverStripe\Forms; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class Form_FieldMap extends ViewableData +class Form_FieldMap extends ModelData { /** diff --git a/src/Forms/GridField/GridField.php b/src/Forms/GridField/GridField.php index 495d0f5efac..12b2522c087 100644 --- a/src/Forms/GridField/GridField.php +++ b/src/Forms/GridField/GridField.php @@ -18,16 +18,16 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\GridField\FormAction\SessionStore; use SilverStripe\Forms\GridField\FormAction\StateStore; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\Filterable; -use SilverStripe\ORM\Limitable; -use SilverStripe\ORM\Sortable; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Filterable; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\Sortable; +use SilverStripe\Model\List\SS_List; use SilverStripe\View\HTML; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Displays a {@link SS_List} in a grid format. @@ -767,7 +767,7 @@ public function FieldHolder($properties = []) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * @param array $attributes * @param string $content * @@ -785,7 +785,7 @@ protected function newCell($total, $index, $record, $attributes, $content) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * @param array $attributes * @param string $content * @@ -803,7 +803,7 @@ protected function newRow($total, $index, $record, $attributes, $content) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * * @return array */ @@ -821,7 +821,7 @@ protected function getRowAttributes($total, $index, $record) /** * @param int $total * @param int $index - * @param ViewableData $record + * @param ModelData $record * * @return array */ @@ -892,7 +892,7 @@ public function getColumns() /** * Get the value from a column. * - * @param ViewableData $record + * @param ModelData $record * @param string $column * * @return string @@ -945,7 +945,7 @@ public function addDataFields($fields) * Use of this method ensures that any special rules around the data for this gridfield are * followed. * - * @param ViewableData $record + * @param ModelData $record * @param string $fieldName * * @return mixed @@ -972,7 +972,7 @@ public function getDataFieldValue($record, $fieldName) /** * Get extra columns attributes used as HTML attributes. * - * @param ViewableData $record + * @param ModelData $record * @param string $column * * @return array diff --git a/src/Forms/GridField/GridFieldAddExistingAutocompleter.php b/src/Forms/GridField/GridFieldAddExistingAutocompleter.php index 8db2bc62723..37cdfb158d2 100644 --- a/src/Forms/GridField/GridFieldAddExistingAutocompleter.php +++ b/src/Forms/GridField/GridFieldAddExistingAutocompleter.php @@ -9,11 +9,11 @@ use SilverStripe\Control\Controller; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataList; use SilverStripe\ORM\Filters\SearchFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; use LogicException; use SilverStripe\Control\HTTPResponse_Exception; diff --git a/src/Forms/GridField/GridFieldAddNewButton.php b/src/Forms/GridField/GridFieldAddNewButton.php index 67d9436574f..2b65e632d95 100644 --- a/src/Forms/GridField/GridFieldAddNewButton.php +++ b/src/Forms/GridField/GridFieldAddNewButton.php @@ -7,7 +7,7 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\RelationList; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldButtonRow.php b/src/Forms/GridField/GridFieldButtonRow.php index 32855478b26..64c29d7090a 100644 --- a/src/Forms/GridField/GridFieldButtonRow.php +++ b/src/Forms/GridField/GridFieldButtonRow.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldConfig.php b/src/Forms/GridField/GridFieldConfig.php index 6851fc7a0da..e0b9bb15125 100644 --- a/src/Forms/GridField/GridFieldConfig.php +++ b/src/Forms/GridField/GridFieldConfig.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Extensible; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; /** * Encapsulates a collection of components following the diff --git a/src/Forms/GridField/GridFieldDataColumns.php b/src/Forms/GridField/GridFieldDataColumns.php index 41b0713d9c9..c12ba899f4f 100644 --- a/src/Forms/GridField/GridFieldDataColumns.php +++ b/src/Forms/GridField/GridFieldDataColumns.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Convert; use InvalidArgumentException; use LogicException; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * @see GridField @@ -155,7 +155,7 @@ public function getFieldFormatting() * HTML for the column, content of the element. * * @param GridField $gridField - * @param ViewableData $record Record displayed in this row + * @param ModelData $record Record displayed in this row * @param string $columnName * @return string HTML for the column. Return NULL to skip. */ @@ -189,7 +189,7 @@ public function getColumnContent($gridField, $record, $columnName) * Attributes for the element containing the content returned by {@link getColumnContent()}. * * @param GridField $gridField - * @param ViewableData $record displayed in this row + * @param ModelData $record displayed in this row * @param string $columnName * @return array */ @@ -225,7 +225,7 @@ public function getColumnMetadata($gridField, $column) /** * Translate a Object.RelationName.ColumnName $columnName into the value that ColumnName returns * - * @param ViewableData $record + * @param ModelData $record * @param string $columnName * @return string|null - returns null if it could not found a value */ @@ -278,7 +278,7 @@ protected function castValue($gridField, $fieldName, $value) /** * * @param GridField $gridField - * @param ViewableData $item + * @param ModelData $item * @param string $fieldName * @param string $value * @return string diff --git a/src/Forms/GridField/GridFieldDeleteAction.php b/src/Forms/GridField/GridFieldDeleteAction.php index a0d81c322bf..6728c9bfb2b 100644 --- a/src/Forms/GridField/GridFieldDeleteAction.php +++ b/src/Forms/GridField/GridFieldDeleteAction.php @@ -6,8 +6,8 @@ use SilverStripe\Control\Controller; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\ORM\ValidationException; -use SilverStripe\View\ViewableData; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Model\ModelData; /** * This class is a {@link GridField} component that adds a delete action for @@ -75,7 +75,7 @@ public function getGroup($gridField, $record, $columnName) /** * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return string|null the attribles for the action */ @@ -107,7 +107,7 @@ public function augmentColumns($gridField, &$columns) * Return any special attributes that will be used for FormField::create_tag() * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return array */ @@ -155,7 +155,7 @@ public function getActions($gridField) /** * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return string|null the HTML for the column */ @@ -183,7 +183,7 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat { $list = $gridField->getList(); if ($actionName == 'deleterecord' || $actionName == 'unlinkrelation') { - /** @var DataObjectInterface&ViewableData $item */ + /** @var DataObjectInterface&ModelData $item */ $item = $list->byID($arguments['RecordID']); if (!$item) { return; @@ -221,7 +221,7 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat /** * * @param GridField $gridField - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record * @param string $columnName * @return GridField_FormAction|null */ diff --git a/src/Forms/GridField/GridFieldDetailForm.php b/src/Forms/GridField/GridFieldDetailForm.php index 624276eb42e..544f6221f3c 100644 --- a/src/Forms/GridField/GridFieldDetailForm.php +++ b/src/Forms/GridField/GridFieldDetailForm.php @@ -18,7 +18,7 @@ use SilverStripe\Forms\Validator; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Provides view and edit forms at GridField-specific URLs. @@ -156,9 +156,9 @@ public function handleItem($gridField, $request) return $handler->handleRequest($request); } - protected function getRecordFromRequest(GridField $gridField, HTTPRequest $request): ?ViewableData + protected function getRecordFromRequest(GridField $gridField, HTTPRequest $request): ?ModelData { - /** @var ViewableData $record */ + /** @var ModelData $record */ if (is_numeric($request->param('ID'))) { $dataList = $gridField->getList(); $record = $dataList->byID($request->param('ID')); @@ -219,7 +219,7 @@ public function getLostRecordRedirection(GridField $gridField, HTTPRequest $requ * Build a request handler for the given record * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * @param RequestHandler $requestHandler * @return GridFieldDetailForm_ItemRequest */ diff --git a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php index ba95158dbcb..555c24a3d0d 100644 --- a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php +++ b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php @@ -17,7 +17,7 @@ use SilverStripe\Forms\FormAction; use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\LiteralField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBHTMLText; @@ -25,13 +25,13 @@ use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\PolymorphicHasManyList; use SilverStripe\ORM\RelationList; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; +use Silverstripe\Model\ArrayData; use SilverStripe\View\HTML; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; class GridFieldDetailForm_ItemRequest extends RequestHandler { @@ -68,7 +68,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler protected $component; /** - * @var ViewableData + * @var ModelData */ protected $record; @@ -100,7 +100,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler * * @param GridField $gridField * @param GridFieldDetailForm $component - * @param ViewableData&DataObjectInterface $record + * @param ModelData&DataObjectInterface $record * @param RequestHandler $requestHandler * @param string $popupFormName */ @@ -528,7 +528,7 @@ protected function getBackLink() * Handles detection of falsey values explicitly saved into the * record by formfields * - * @param ViewableData $record + * @param ModelData $record * @param SS_List $list * @return array List of data to write to the relation */ @@ -785,7 +785,7 @@ public function httpError($errorCode, $errorMessage = null) * @param array $data * @param Form $form * @throws ValidationException On error - * @return ViewableData&DataObjectInterface Saved record + * @return ModelData&DataObjectInterface Saved record */ protected function saveFormIntoRecord($data, $form) { @@ -905,7 +905,7 @@ public function getGridField() } /** - * @return ViewableData + * @return ModelData */ public function getRecord() { diff --git a/src/Forms/GridField/GridFieldEditButton.php b/src/Forms/GridField/GridFieldEditButton.php index e3119fa6242..def180463f7 100644 --- a/src/Forms/GridField/GridFieldEditButton.php +++ b/src/Forms/GridField/GridFieldEditButton.php @@ -3,9 +3,9 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Control\Controller; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Provides the entry point to editing a single record presented by the @@ -91,7 +91,7 @@ public function augmentColumns($gridField, &$columns) * Return any special attributes that will be used for FormField::create_tag() * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * @param string $columnName * @return array */ @@ -139,7 +139,7 @@ public function getActions($gridField) /** * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * @param string $columnName * @return string The HTML for the column */ diff --git a/src/Forms/GridField/GridFieldExportButton.php b/src/Forms/GridField/GridFieldExportButton.php index 710b0e20757..6b543b8c49e 100644 --- a/src/Forms/GridField/GridFieldExportButton.php +++ b/src/Forms/GridField/GridFieldExportButton.php @@ -8,8 +8,8 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Core\Config\Config; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ModelData; /** * Adds an "Export list" button to the bottom of a {@link GridField}. @@ -228,7 +228,7 @@ public function generateExportFileData($gridField) ? $gridFieldColumnsComponent->getColumnsHandled($gridField) : []; - /** @var SS_List $items */ + /** @var SS_List $items */ // Remove limit as the list may be paginated, we want the full list for the export $items = $items->limit(null); diff --git a/src/Forms/GridField/GridFieldFilterHeader.php b/src/Forms/GridField/GridFieldFilterHeader.php index 2e96e28f889..e6dda64f84a 100755 --- a/src/Forms/GridField/GridFieldFilterHeader.php +++ b/src/Forms/GridField/GridFieldFilterHeader.php @@ -11,10 +11,10 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\Schema\FormSchema; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Search\SearchContext; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldFooter.php b/src/Forms/GridField/GridFieldFooter.php index 958e8ff705e..5eacf71ec4d 100644 --- a/src/Forms/GridField/GridFieldFooter.php +++ b/src/Forms/GridField/GridFieldFooter.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridFieldGroupDeleteAction.php b/src/Forms/GridField/GridFieldGroupDeleteAction.php index cb7fdb19d3b..de354332334 100644 --- a/src/Forms/GridField/GridFieldGroupDeleteAction.php +++ b/src/Forms/GridField/GridFieldGroupDeleteAction.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Member; use SilverStripe\Security\Permission; use SilverStripe\Security\Security; diff --git a/src/Forms/GridField/GridFieldImportButton.php b/src/Forms/GridField/GridFieldImportButton.php index 61865a2dae0..117b7d6fd9f 100644 --- a/src/Forms/GridField/GridFieldImportButton.php +++ b/src/Forms/GridField/GridFieldImportButton.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Forms\Form; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; class GridFieldImportButton extends AbstractGridFieldComponent implements GridField_HTMLProvider diff --git a/src/Forms/GridField/GridFieldLazyLoader.php b/src/Forms/GridField/GridFieldLazyLoader.php index e117116cb76..59844114e82 100755 --- a/src/Forms/GridField/GridFieldLazyLoader.php +++ b/src/Forms/GridField/GridFieldLazyLoader.php @@ -4,9 +4,9 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\TabSet; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\Filterable; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\Filterable; +use SilverStripe\Model\List\SS_List; /** * GridFieldLazyLoader alters the {@link GridField} behavior to delay rendering of rows until the tab containing the diff --git a/src/Forms/GridField/GridFieldLevelup.php b/src/Forms/GridField/GridFieldLevelup.php index 32d22d30d61..0d6e8d59041 100644 --- a/src/Forms/GridField/GridFieldLevelup.php +++ b/src/Forms/GridField/GridFieldLevelup.php @@ -6,7 +6,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\Hierarchy\Hierarchy; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\HTML; use SilverStripe\View\SSViewer; diff --git a/src/Forms/GridField/GridFieldPaginator.php b/src/Forms/GridField/GridFieldPaginator.php index 5e2c4f01a2c..092bd4c065d 100755 --- a/src/Forms/GridField/GridFieldPaginator.php +++ b/src/Forms/GridField/GridFieldPaginator.php @@ -3,10 +3,10 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Core\Config\Configurable; -use SilverStripe\ORM\Limitable; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\UnsavedRelationList; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; use LogicException; use SilverStripe\Dev\Deprecation; diff --git a/src/Forms/GridField/GridFieldPrintButton.php b/src/Forms/GridField/GridFieldPrintButton.php index 96a47508859..b5ade126460 100644 --- a/src/Forms/GridField/GridFieldPrintButton.php +++ b/src/Forms/GridField/GridFieldPrintButton.php @@ -6,13 +6,13 @@ use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\Convert; use SilverStripe\Core\Extensible; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\Security\Security; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\Requirements; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Adds an "Print" button to the bottom or top of a GridField. @@ -233,7 +233,7 @@ public function generatePrintData(GridField $gridField) $gridFieldColumnsComponent = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class); - /** @var ViewableData $item */ + /** @var ModelData $item */ foreach ($items->limit(null) as $item) { // Assume item can be viewed if canView() isn't implemented if (!$item->hasMethod('canView') || $item->canView()) { diff --git a/src/Forms/GridField/GridFieldSortableHeader.php b/src/Forms/GridField/GridFieldSortableHeader.php index d0943fba374..bd89c657441 100644 --- a/src/Forms/GridField/GridFieldSortableHeader.php +++ b/src/Forms/GridField/GridFieldSortableHeader.php @@ -4,11 +4,11 @@ use SilverStripe\Forms\LiteralField; use SilverStripe\ORM\DataObjectSchema; -use SilverStripe\ORM\Sortable; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Sortable; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; use LogicException; use SilverStripe\Core\ClassInfo; diff --git a/src/Forms/GridField/GridFieldViewButton.php b/src/Forms/GridField/GridFieldViewButton.php index a0efccd6a67..d944f07654a 100644 --- a/src/Forms/GridField/GridFieldViewButton.php +++ b/src/Forms/GridField/GridFieldViewButton.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Control\Controller; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridField_ActionMenu.php b/src/Forms/GridField/GridField_ActionMenu.php index 5e409823b7f..c52bd045d7b 100644 --- a/src/Forms/GridField/GridField_ActionMenu.php +++ b/src/Forms/GridField/GridField_ActionMenu.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; /** diff --git a/src/Forms/GridField/GridField_ActionMenuItem.php b/src/Forms/GridField/GridField_ActionMenuItem.php index d07b23b8867..2de726e96bc 100644 --- a/src/Forms/GridField/GridField_ActionMenuItem.php +++ b/src/Forms/GridField/GridField_ActionMenuItem.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * GridField action menu item interface, this provides data so the action @@ -21,7 +21,7 @@ interface GridField_ActionMenuItem extends GridFieldComponent * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return string $title */ @@ -33,7 +33,7 @@ public function getTitle($gridField, $record, $columnName); * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return array $data */ @@ -46,7 +46,7 @@ public function getExtraData($gridField, $record, $columnName); * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return string|null $group */ diff --git a/src/Forms/GridField/GridField_ActionMenuLink.php b/src/Forms/GridField/GridField_ActionMenuLink.php index 77d0fa3f0f7..6a5798cb346 100644 --- a/src/Forms/GridField/GridField_ActionMenuLink.php +++ b/src/Forms/GridField/GridField_ActionMenuLink.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Allows GridField_ActionMenuItem to act as a link @@ -15,7 +15,7 @@ interface GridField_ActionMenuLink extends GridField_ActionMenuItem * @see {@link GridField_ActionMenu->getColumnContent()} * * @param GridField $gridField - * @param ViewableData $record + * @param ModelData $record * * @return string $url */ diff --git a/src/Forms/GridField/GridField_ColumnProvider.php b/src/Forms/GridField/GridField_ColumnProvider.php index ee900ea400b..ab169378ea9 100644 --- a/src/Forms/GridField/GridField_ColumnProvider.php +++ b/src/Forms/GridField/GridField_ColumnProvider.php @@ -34,7 +34,7 @@ public function getColumnsHandled($gridField); * HTML for the column, content of the element. * * @param GridField $gridField - * @param ViewableData $record - Record displayed in this row + * @param ModelData $record - Record displayed in this row * @param string $columnName * @return string - HTML for the column. Return NULL to skip. */ @@ -44,7 +44,7 @@ public function getColumnContent($gridField, $record, $columnName); * Attributes for the element containing the content returned by {@link getColumnContent()}. * * @param GridField $gridField - * @param ViewableData $record displayed in this row + * @param ModelData $record displayed in this row * @param string $columnName * @return array */ diff --git a/src/Forms/GridField/GridField_DataManipulator.php b/src/Forms/GridField/GridField_DataManipulator.php index cfd00dcdf46..d0a05819f3c 100644 --- a/src/Forms/GridField/GridField_DataManipulator.php +++ b/src/Forms/GridField/GridField_DataManipulator.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\GridField; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; /** * Can modify the data list. diff --git a/src/Forms/GridField/GridField_SaveHandler.php b/src/Forms/GridField/GridField_SaveHandler.php index f562426156e..8e85f08b7c3 100644 --- a/src/Forms/GridField/GridField_SaveHandler.php +++ b/src/Forms/GridField/GridField_SaveHandler.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A component which is used to handle when a {@link GridField} is saved into @@ -16,7 +16,7 @@ interface GridField_SaveHandler extends GridFieldComponent * Called when a grid field is saved - i.e. the form is submitted. * * @param GridField $grid - * @param DataObjectInterface&ViewableData $record + * @param DataObjectInterface&ModelData $record */ public function handleSave(GridField $grid, DataObjectInterface $record); } diff --git a/src/Forms/GroupedDropdownField.php b/src/Forms/GroupedDropdownField.php index 59438ff45dc..cecb1897e6f 100644 --- a/src/Forms/GroupedDropdownField.php +++ b/src/Forms/GroupedDropdownField.php @@ -2,9 +2,9 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayLib; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Core\ArrayLib; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; /** * Grouped dropdown, using optgroup tags. diff --git a/src/Forms/ListboxField.php b/src/Forms/ListboxField.php index b305c453d6a..7634d40dc7e 100644 --- a/src/Forms/ListboxField.php +++ b/src/Forms/ListboxField.php @@ -2,8 +2,8 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; /** * Multi-line listbox field, created from a select tag. diff --git a/src/Forms/LiteralField.php b/src/Forms/LiteralField.php index d90b02a3c2d..0dda550c0c3 100644 --- a/src/Forms/LiteralField.php +++ b/src/Forms/LiteralField.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * This field lets you put an arbitrary piece of HTML into your forms. @@ -51,7 +51,7 @@ public function __construct($name, $content) */ public function FieldHolder($properties = []) { - if ($this->content instanceof ViewableData) { + if ($this->content instanceof ModelData) { $context = $this->content; if ($properties) { diff --git a/src/Forms/LookupField.php b/src/Forms/LookupField.php index 113ba553814..ac388fc394b 100644 --- a/src/Forms/LookupField.php +++ b/src/Forms/LookupField.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; diff --git a/src/Forms/MoneyField.php b/src/Forms/MoneyField.php index 32961addf61..1d8e4688911 100644 --- a/src/Forms/MoneyField.php +++ b/src/Forms/MoneyField.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms; use InvalidArgumentException; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\FieldType\DBMoney; use SilverStripe\ORM\DataObjectInterface; diff --git a/src/Forms/OptionsetField.php b/src/Forms/OptionsetField.php index f47d6dd576e..5e9ff6dc654 100644 --- a/src/Forms/OptionsetField.php +++ b/src/Forms/OptionsetField.php @@ -3,8 +3,8 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; /** * Set of radio buttons designed to emulate a dropdown. diff --git a/src/Forms/RequiredFields.php b/src/Forms/RequiredFields.php index 9412e6cfbbe..395c18a9647 100644 --- a/src/Forms/RequiredFields.php +++ b/src/Forms/RequiredFields.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; /** * Required Fields allows you to set which fields need to be present before diff --git a/src/Forms/Schema/FormSchema.php b/src/Forms/Schema/FormSchema.php index a8b712a14e7..e5cfc639a79 100644 --- a/src/Forms/Schema/FormSchema.php +++ b/src/Forms/Schema/FormSchema.php @@ -8,7 +8,7 @@ use SilverStripe\Forms\CompositeField; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use LogicException; /** diff --git a/src/Forms/SearchableDropdownTrait.php b/src/Forms/SearchableDropdownTrait.php index 83a9a0bc13e..f9dbd043103 100644 --- a/src/Forms/SearchableDropdownTrait.php +++ b/src/Forms/SearchableDropdownTrait.php @@ -8,14 +8,14 @@ use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\Relation; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\ORM\Search\SearchContext; use SilverStripe\Security\SecurityToken; use SilverStripe\ORM\RelationList; diff --git a/src/Forms/SearchableLookupField.php b/src/Forms/SearchableLookupField.php index 85188045a61..610d2385f30 100644 --- a/src/Forms/SearchableLookupField.php +++ b/src/Forms/SearchableLookupField.php @@ -3,10 +3,10 @@ namespace SilverStripe\Forms; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; /** diff --git a/src/Forms/SelectField.php b/src/Forms/SelectField.php index fb48443be9b..22485590db9 100644 --- a/src/Forms/SelectField.php +++ b/src/Forms/SelectField.php @@ -2,8 +2,8 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\Map; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\List\Map; use ArrayAccess; /** diff --git a/src/Forms/SelectionGroup.php b/src/Forms/SelectionGroup.php index 017905b2192..d814960f6bb 100644 --- a/src/Forms/SelectionGroup.php +++ b/src/Forms/SelectionGroup.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\View\HTML; diff --git a/src/Forms/SingleLookupField.php b/src/Forms/SingleLookupField.php index 9f3e8883a1f..5590574caa1 100644 --- a/src/Forms/SingleLookupField.php +++ b/src/Forms/SingleLookupField.php @@ -4,7 +4,7 @@ use SilverStripe\Core\Convert; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\ORM\Map; +use SilverStripe\Model\List\Map; use SilverStripe\ORM\FieldType\DBField; /** diff --git a/src/Forms/TreeMultiselectField.php b/src/Forms/TreeMultiselectField.php index eb4e1e02e23..a1362f24715 100644 --- a/src/Forms/TreeMultiselectField.php +++ b/src/Forms/TreeMultiselectField.php @@ -5,15 +5,15 @@ use http\Exception\InvalidArgumentException; use SilverStripe\Control\Controller; use SilverStripe\Core\Convert; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\Relation; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\Security\Group; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * This formfield represents many-many joins using a tree selector shown in a dropdown styled element @@ -211,7 +211,7 @@ public function Field($properties = []) if ($items && count($items ?? [])) { foreach ($items as $item) { $idArray[] = $item->ID; - $titleArray[] = ($item instanceof ViewableData) + $titleArray[] = ($item instanceof ModelData) ? $item->obj($this->getLabelField())->forTemplate() : Convert::raw2xml($item->{$this->getLabelField()}); } diff --git a/src/Forms/Validator.php b/src/Forms/Validator.php index 60594e011d4..786931ea87c 100644 --- a/src/Forms/Validator.php +++ b/src/Forms/Validator.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Extensible; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * This validation class handles all form and custom form validation through the use of Required diff --git a/src/View/ArrayData.php b/src/Model/ArrayData.php similarity index 91% rename from src/View/ArrayData.php rename to src/Model/ArrayData.php index c107fd060c8..185eebf7b79 100644 --- a/src/View/ArrayData.php +++ b/src/Model/ArrayData.php @@ -1,13 +1,13 @@ * new ArrayData(array( @@ -16,7 +16,7 @@ * )); * */ -class ArrayData extends ViewableData +class ArrayData extends ModelData { /** @@ -65,7 +65,7 @@ public function toMap() * * * If the value is an object but not an instance of - * ViewableData, it will be converted recursively to an + * ModelData, it will be converted recursively to an * ArrayData. * * If the value is an associative array, it will likewise be @@ -74,7 +74,7 @@ public function toMap() public function getField(string $fieldName): mixed { $value = $this->array[$fieldName]; - if (is_object($value) && !($value instanceof ViewableData) && !is_iterable($value)) { + if (is_object($value) && !($value instanceof ModelData) && !is_iterable($value)) { return new ArrayData($value); } elseif (ArrayLib::is_associative($value)) { return new ArrayData($value); diff --git a/src/ORM/ArrayList.php b/src/Model/List/ArrayList.php similarity index 98% rename from src/ORM/ArrayList.php rename to src/Model/List/ArrayList.php index 53527089963..a68b016f26e 100644 --- a/src/ORM/ArrayList.php +++ b/src/Model/List/ArrayList.php @@ -1,19 +1,15 @@ * @implements Limitable */ -class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, Limitable +class ArrayList extends ModelData implements SS_List, Filterable, Sortable, Limitable { use SearchFilterable; @@ -579,7 +575,7 @@ public function canFilterBy($by) return array_key_exists($by, $firstRecord); } - if ($firstRecord instanceof ViewableData) { + if ($firstRecord instanceof ModelData) { return $firstRecord->hasField($by); } diff --git a/src/ORM/Filterable.php b/src/Model/List/Filterable.php similarity index 99% rename from src/ORM/Filterable.php rename to src/Model/List/Filterable.php index ce5196e4654..3ede8179faa 100644 --- a/src/ORM/Filterable.php +++ b/src/Model/List/Filterable.php @@ -1,6 +1,6 @@ * @implements Limitable */ -abstract class ListDecorator extends ViewableData implements SS_List, Sortable, Filterable, Limitable +abstract class ListDecorator extends ModelData implements SS_List, Sortable, Filterable, Limitable { /** * @var TList diff --git a/src/ORM/Map.php b/src/Model/List/Map.php similarity index 99% rename from src/ORM/Map.php rename to src/Model/List/Map.php index a1b81f609d8..e523b8c46d3 100644 --- a/src/ORM/Map.php +++ b/src/Model/List/Map.php @@ -1,6 +1,6 @@ failover) { @@ -156,7 +157,7 @@ public function setFailover(ViewableData $failover): void /** * Get the current failover object if set */ - public function getFailover(): ?ViewableData + public function getFailover(): ?ModelData { return $this->failover; } @@ -186,7 +187,7 @@ public function getField(string $fieldName): mixed public function setField(string $fieldName, mixed $value): static { $this->objCacheClear(); - // prior to PHP 8.2 support ViewableData::setField() simply used `$this->field = $value;` + // prior to PHP 8.2 support ModelData::setField() simply used `$this->field = $value;` // so the following logic essentially mimics this behaviour, though without the use // of now deprecated dynamic properties if ($this->isAccessibleProperty($fieldName)) { @@ -213,7 +214,7 @@ public function hasDynamicData(string $field): bool /** * Returns true if a method exists for the current class which isn't private. - * Also returns true for private methods if $this is ViewableData (not a subclass) + * Also returns true for private methods if $this is ModelData (not a subclass) */ private function isAccessibleMethod(string $method): bool { @@ -221,25 +222,25 @@ private function isAccessibleMethod(string $method): bool // Methods added via extensions are accessible return $this->hasCustomMethod($method); } - // All methods defined on ViewableData are accessible to ViewableData - if (static::class === ViewableData::class) { + // All methods defined on ModelData are accessible to ModelData + if (static::class === ModelData::class) { return true; } - // Private methods defined on subclasses are not accessible to ViewableData + // Private methods defined on subclasses are not accessible to ModelData $reflectionMethod = new ReflectionMethod($this, $method); return !$reflectionMethod->isPrivate(); } /** * Returns true if a property exists for the current class which isn't private. - * Also returns true for private properties if $this is ViewableData (not a subclass) + * Also returns true for private properties if $this is ModelData (not a subclass) */ private function isAccessibleProperty(string $property): bool { if (!property_exists($this, $property)) { return false; } - if (static::class === ViewableData::class) { + if (static::class === ModelData::class) { return true; } $reflectionProperty = new ReflectionProperty($this, $property); @@ -249,15 +250,15 @@ private function isAccessibleProperty(string $property): bool // ----------------------------------------------------------------------------------------------------------------- /** - * Add methods from the {@link ViewableData::$failover} object, as well as wrapping any methods prefixed with an - * underscore into a {@link ViewableData::cachedCall()}. + * Add methods from the {@link ModelData::$failover} object, as well as wrapping any methods prefixed with an + * underscore into a {@link ModelData::cachedCall()}. * * @throws LogicException */ public function defineMethods() { if ($this->failover && !is_object($this->failover)) { - throw new LogicException("ViewableData::\$failover set to a non-object"); + throw new LogicException("ModelData::\$failover set to a non-object"); } if ($this->failover) { $this->addMethodsFrom('failover'); @@ -272,23 +273,23 @@ public function defineMethods() } /** - * Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance + * Merge some arbitrary data in with this object. This method returns a {@link ModelDataCustomised} instance * with references to both this and the new custom data. * * Note that any fields you specify will take precedence over the fields on this object. */ - public function customise(array|ViewableData $data): ViewableData + public function customise(array|ModelData $data): ModelData { if (is_array($data) && (empty($data) || ArrayLib::is_associative($data))) { $data = new ArrayData($data); } - if ($data instanceof ViewableData) { - return new ViewableData_Customised($this, $data); + if ($data instanceof ModelData) { + return new ModelDataCustomised($this, $data); } throw new InvalidArgumentException( - 'ViewableData->customise(): $data must be an associative array or a ViewableData instance' + 'ModelData->customise(): $data must be an associative array or a ModelData instance' ); } @@ -311,12 +312,12 @@ public function __toString(): string return static::class; } - public function getCustomisedObj(): ?ViewableData + public function getCustomisedObj(): ?ModelData { return $this->customisedObject; } - public function setCustomisedObj(ViewableData $object) + public function setCustomisedObj(ModelData $object) { $this->customisedObject = $object; } @@ -415,9 +416,9 @@ public function escapeTypeForField(string $field): string * - an SSViewer instance * * @param string|array|SSViewer $template the template to render into - * @param ViewableData|array|null $customFields fields to customise() the object with before rendering + * @param ModelData|array|null $customFields fields to customise() the object with before rendering */ - public function renderWith($template, ViewableData|array|null $customFields = null): DBHTMLText + public function renderWith($template, ModelData|array|null $customFields = null): DBHTMLText { if (!is_object($template)) { $template = SSViewer::create($template); @@ -425,7 +426,7 @@ public function renderWith($template, ViewableData|array|null $customFields = nu $data = $this->getCustomisedObj() ?: $this; - if ($customFields instanceof ViewableData) { + if ($customFields instanceof ModelData) { $data = $data->customise($customFields); } if ($template instanceof SSViewer) { @@ -433,7 +434,7 @@ public function renderWith($template, ViewableData|array|null $customFields = nu } throw new UnexpectedValueException( - "ViewableData::renderWith(): unexpected " . get_class($template) . " object, expected an SSViewer instance" + "ModelData::renderWith(): unexpected " . get_class($template) . " object, expected an SSViewer instance" ); } @@ -540,7 +541,7 @@ public function obj( } } - // Wrap list arrays in ViewableData so templates can handle them + // Wrap list arrays in ModelData so templates can handle them if (is_array($value) && array_is_list($value)) { $value = ArrayList::create($value); } @@ -563,7 +564,7 @@ public function obj( } /** - * A simple wrapper around {@link ViewableData::obj()} that automatically caches the result so it can be used again + * A simple wrapper around {@link ModelData::obj()} that automatically caches the result so it can be used again * without re-running the method. * * @return Object|DBField @@ -580,7 +581,7 @@ public function cachedCall(string $fieldName, array $arguments = [], ?string $ca public function hasValue(string $field, array $arguments = [], bool $cache = true): bool { $result = $this->obj($field, $arguments, $cache); - if ($result instanceof ViewableData) { + if ($result instanceof ModelData) { return $result->exists(); } return (bool) $result; @@ -623,7 +624,7 @@ public function getXMLValues(array $fields): array */ public function getViewerTemplates(string $suffix = ''): array { - return SSViewer::get_templates_by_class(static::class, $suffix, ViewableData::class); + return SSViewer::get_templates_by_class(static::class, $suffix, ModelData::class); } /** @@ -639,12 +640,12 @@ public function Me(): static * Get part of the current classes ancestry to be used as a CSS class. * * This method returns an escaped string of CSS classes representing the current classes ancestry until it hits a - * stop point - e.g. "Page DataObject ViewableData". + * stop point - e.g. "Page DataObject ModelData". * - * @param string $stopAtClass the class to stop at (default: ViewableData) + * @param string $stopAtClass the class to stop at (default: ModelData) * @uses ClassInfo */ - public function CSSClasses(string $stopAtClass = ViewableData::class): string + public function CSSClasses(string $stopAtClass = ModelData::class): string { $classes = []; $classAncestry = array_reverse(ClassInfo::ancestry(static::class) ?? []); @@ -671,8 +672,8 @@ public function CSSClasses(string $stopAtClass = ViewableData::class): string /** * Return debug information about this object that can be rendered into a template */ - public function Debug(): ViewableData|string + public function Debug(): ModelData|string { - return ViewableData_Debugger::create($this); + return ModelDataDebugger::create($this); } } diff --git a/src/View/ViewableData_Customised.php b/src/Model/ModelDataCustomised.php similarity index 87% rename from src/View/ViewableData_Customised.php rename to src/Model/ModelDataCustomised.php index 02b4dbe0041..6ae73be21ac 100644 --- a/src/View/ViewableData_Customised.php +++ b/src/Model/ModelDataCustomised.php @@ -1,17 +1,17 @@ original = $originalObject; $this->customised = $customisedObject; diff --git a/src/View/ViewableData_Debugger.php b/src/Model/ModelDataDebugger.php similarity index 86% rename from src/View/ViewableData_Debugger.php rename to src/Model/ModelDataDebugger.php index 2c496610435..8eeacffe834 100644 --- a/src/View/ViewableData_Debugger.php +++ b/src/Model/ModelDataDebugger.php @@ -1,17 +1,17 @@ object = $object; parent::__construct(); @@ -72,7 +72,7 @@ public function forTemplate(?string $field = null): string // check for an extra attached data if ($this->object->hasMethod('data') && $this->object->data() != $this->object) { - $debug .= ViewableData_Debugger::create($this->object->data())->forTemplate(); + $debug .= ModelDataDebugger::create($this->object->data())->forTemplate(); } return $debug; diff --git a/src/ORM/Connect/DBQueryBuilder.php b/src/ORM/Connect/DBQueryBuilder.php index f2f16d03413..210b0130198 100644 --- a/src/ORM/Connect/DBQueryBuilder.php +++ b/src/ORM/Connect/DBQueryBuilder.php @@ -12,8 +12,8 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DB; -use SilverStripe\ORM\ListDecorator; -use SilverStripe\ORM\Map; +use SilverStripe\Model\List\ListDecorator; +use SilverStripe\Model\List\Map; use SilverStripe\ORM\Queries\SQLExpression; use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLDelete; diff --git a/src/ORM/Connect/Database.php b/src/ORM/Connect/Database.php index 525ff3fdbed..871e8d120ab 100644 --- a/src/ORM/Connect/Database.php +++ b/src/ORM/Connect/Database.php @@ -6,7 +6,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\Dev\Debug; use SilverStripe\ORM\DB; -use SilverStripe\ORM\PaginatedList; +use SilverStripe\Model\List\PaginatedList; use SilverStripe\ORM\Queries\SQLUpdate; use SilverStripe\ORM\Queries\SQLInsert; use BadMethodCallException; diff --git a/src/ORM/Connect/MySQLDatabase.php b/src/ORM/Connect/MySQLDatabase.php index 0935300f22a..0308ae4ffb6 100644 --- a/src/ORM/Connect/MySQLDatabase.php +++ b/src/ORM/Connect/MySQLDatabase.php @@ -6,9 +6,9 @@ use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Convert; -use SilverStripe\ORM\PaginatedList; +use SilverStripe\Model\List\PaginatedList; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\Queries\SQLSelect; use Exception; diff --git a/src/ORM/DataList.php b/src/ORM/DataList.php index 23c89029de4..057ee9d68b6 100644 --- a/src/ORM/DataList.php +++ b/src/ORM/DataList.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\Debug; use SilverStripe\ORM\Queries\SQLConditionGroup; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Exception; use InvalidArgumentException; use LogicException; @@ -13,7 +13,7 @@ use SilverStripe\ORM\Connect\Query; use Traversable; use SilverStripe\ORM\DataQuery; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Filters\SearchFilterable; /** @@ -42,7 +42,7 @@ * @implements Sortable * @implements Limitable */ -class DataList extends ViewableData implements SS_List, Filterable, Sortable, Limitable +class DataList extends ModelData implements SS_List, Filterable, Sortable, Limitable { use SearchFilterable; @@ -924,7 +924,7 @@ public function createDataObject($row) private function setDataObjectEagerLoadedData(DataObject $item): void { - // cache $item->ID at the top of this method to reduce calls to ViewableData::__get() + // cache $item->ID at the top of this method to reduce calls to ModelData::__get() $itemID = $item->ID; foreach (array_keys($this->eagerLoadedData) as $relation) { if (array_key_exists($itemID, $this->eagerLoadedData[$relation])) { diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php index da89460b85e..fd0deb5f947 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -40,7 +40,7 @@ use SilverStripe\Security\Permission; use SilverStripe\Security\Security; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use stdClass; /** @@ -111,7 +111,7 @@ * @property string $Created Date and time of DataObject creation. * @property string $ObsoleteClassName If ClassName no longer exists this will be set to the legacy value */ -class DataObject extends ViewableData implements DataObjectInterface, i18nEntityProvider, Resettable +class DataObject extends ModelData implements DataObjectInterface, i18nEntityProvider, Resettable { /** * Human-readable singular name. @@ -3280,7 +3280,7 @@ public function dbObject($fieldName) * can throw a LogicException. * * @param string $fieldPath List of paths on this object. All items in this path - * must be ViewableData implementors + * must be ModelData implementors * * @return mixed DBField of the field on the object or a DataList instance. * @throws LogicException If accessing invalid relations @@ -3305,7 +3305,7 @@ public function relObject($fieldPath) $component = $singleton->dbObject($relation) ?: $component->relation($relation); } elseif ($component instanceof DataObject && ($dbObject = $component->dbObject($relation))) { $component = $dbObject; - } elseif ($component instanceof ViewableData && $component->hasField($relation)) { + } elseif ($component instanceof ModelData && $component->hasField($relation)) { $component = $component->obj($relation); } else { throw new LogicException( @@ -3944,7 +3944,7 @@ public function fieldLabels($includerelations = true) $ancestry = array_reverse($ancestry ?? []); if ($ancestry) { foreach ($ancestry as $ancestorClass) { - if ($ancestorClass === ViewableData::class) { + if ($ancestorClass === ModelData::class) { break; } $types = [ diff --git a/src/ORM/EagerLoadedList.php b/src/ORM/EagerLoadedList.php index e006698007c..337d9e26418 100644 --- a/src/ORM/EagerLoadedList.php +++ b/src/ORM/EagerLoadedList.php @@ -3,7 +3,7 @@ namespace SilverStripe\ORM; use SilverStripe\Dev\Debug; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\FieldType\DBField; use BadMethodCallException; @@ -29,7 +29,7 @@ * @implements Sortable * @implements Limitable */ -class EagerLoadedList extends ViewableData implements Relation, SS_List, Filterable, Sortable, Limitable +class EagerLoadedList extends ModelData implements Relation, SS_List, Filterable, Sortable, Limitable { use SearchFilterable; diff --git a/src/ORM/FieldType/DBBoolean.php b/src/ORM/FieldType/DBBoolean.php index 034a047ee67..c4d4c1c4870 100644 --- a/src/ORM/FieldType/DBBoolean.php +++ b/src/ORM/FieldType/DBBoolean.php @@ -6,7 +6,7 @@ use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FormField; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a boolean field. @@ -44,7 +44,7 @@ public function NiceAsBoolean(): string return ($this->value) ? 'true' : 'false'; } - public function saveInto(ViewableData $dataObject): void + public function saveInto(ModelData $dataObject): void { $fieldName = $this->name; if ($fieldName) { diff --git a/src/ORM/FieldType/DBClassName.php b/src/ORM/FieldType/DBClassName.php index d8008626bca..cdd2228b3a9 100644 --- a/src/ORM/FieldType/DBClassName.php +++ b/src/ORM/FieldType/DBClassName.php @@ -6,7 +6,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a classname selector, which respects obsolete clasess. @@ -115,7 +115,7 @@ public function getEnum(): array return array_values($classNames ?? []); } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { parent::setValue($value, $record, $markChanged); diff --git a/src/ORM/FieldType/DBComposite.php b/src/ORM/FieldType/DBComposite.php index 568eb5bf67a..7060417eadc 100644 --- a/src/ORM/FieldType/DBComposite.php +++ b/src/ORM/FieldType/DBComposite.php @@ -7,7 +7,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\Queries\SQLSelect; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Extend this class when designing a {@link DBField} that doesn't have a 1-1 mapping with a database field. @@ -42,7 +42,7 @@ abstract class DBComposite extends DBField /** * Either the parent dataobject link, or a record of saved values for each field */ - protected array|ViewableData $record = []; + protected array|ModelData $record = []; public function __set(string $property, mixed $value): void { @@ -157,11 +157,11 @@ public function requireField(): void * If $record is assigned to a dataobject, this field becomes a loose wrapper over * the records on that object instead. * - * {@see ViewableData::obj} + * {@see ModelData::obj} * - * @param null|array|ViewableData $record Parent object to this field, which could be a DataObject, record array, or other + * @param null|array|ModelData $record Parent object to this field, which could be a DataObject, record array, or other */ - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $this->isChanged = $markChanged; @@ -198,7 +198,7 @@ public function bindTo(DataObject $dataObject): void $this->record = $dataObject; } - public function saveInto(ViewableData $dataObject): void + public function saveInto(ModelData $dataObject): void { foreach ($this->compositeDatabaseFields() as $field => $spec) { // Save into record diff --git a/src/ORM/FieldType/DBCurrency.php b/src/ORM/FieldType/DBCurrency.php index 20e612365d3..22d70d398dd 100644 --- a/src/ORM/FieldType/DBCurrency.php +++ b/src/ORM/FieldType/DBCurrency.php @@ -4,7 +4,7 @@ use SilverStripe\Forms\CurrencyField; use SilverStripe\Forms\FormField; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a decimal field containing a currency amount. @@ -51,7 +51,7 @@ public function Whole(): string return $val; } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $matches = null; if (is_numeric($value)) { diff --git a/src/ORM/FieldType/DBDate.php b/src/ORM/FieldType/DBDate.php index 40dcbaac963..d8a271d7878 100644 --- a/src/ORM/FieldType/DBDate.php +++ b/src/ORM/FieldType/DBDate.php @@ -11,7 +11,7 @@ use SilverStripe\ORM\DB; use SilverStripe\Security\Member; use SilverStripe\Security\Security; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a date field. @@ -42,7 +42,7 @@ class DBDate extends DBField */ public const ISO_LOCALE = 'en_US'; - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $value = $this->parseDate($value); if ($value === false) { diff --git a/src/ORM/FieldType/DBDatetime.php b/src/ORM/FieldType/DBDatetime.php index 3f1cbf81581..eb6dc70fbed 100644 --- a/src/ORM/FieldType/DBDatetime.php +++ b/src/ORM/FieldType/DBDatetime.php @@ -11,7 +11,7 @@ use SilverStripe\Security\Member; use SilverStripe\Security\Security; use SilverStripe\View\TemplateGlobalProvider; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a date-time field. @@ -68,7 +68,7 @@ public function setImmutable(bool $immutable): static return $this; } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { if ($this->immutable) { // This field is set as immutable so we have to create a new field instance diff --git a/src/ORM/FieldType/DBDecimal.php b/src/ORM/FieldType/DBDecimal.php index 521ff8b95b6..deab1bcd05c 100644 --- a/src/ORM/FieldType/DBDecimal.php +++ b/src/ORM/FieldType/DBDecimal.php @@ -5,7 +5,7 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\NumericField; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a Decimal field. @@ -67,7 +67,7 @@ public function requireField(): void DB::require_field($this->tableName, $this->name, $values); } - public function saveInto(ViewableData $model): void + public function saveInto(ModelData $model): void { $fieldName = $this->name; diff --git a/src/ORM/FieldType/DBEnum.php b/src/ORM/FieldType/DBEnum.php index 7f0eaba527a..e71e6d17d9c 100644 --- a/src/ORM/FieldType/DBEnum.php +++ b/src/ORM/FieldType/DBEnum.php @@ -6,7 +6,7 @@ use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FormField; use SilverStripe\Forms\SelectField; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\Connect\MySQLDatabase; use SilverStripe\ORM\DB; diff --git a/src/ORM/FieldType/DBField.php b/src/ORM/FieldType/DBField.php index 97900eca8fd..38efb57583f 100644 --- a/src/ORM/FieldType/DBField.php +++ b/src/ORM/FieldType/DBField.php @@ -9,7 +9,7 @@ use SilverStripe\Forms\TextField; use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Queries\SQLSelect; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Single field in the database. @@ -41,7 +41,7 @@ * } * */ -abstract class DBField extends ViewableData implements DBIndexable +abstract class DBField extends ModelData implements DBIndexable { /** @@ -198,12 +198,12 @@ public function getValue(): mixed * and actually changing its values, it needs a {@link $markChanged} * parameter. * - * @param null|ViewableData|array $record An array or object that this field is part of + * @param null|ModelData|array $record An array or object that this field is part of * @param bool $markChanged Indicate whether this field should be marked changed. * Set to FALSE if you are initializing this field after construction, rather * than setting a new value. */ - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $this->value = $value; return $this; @@ -453,7 +453,7 @@ public function nullValue(): mixed /** * Saves this field to the given data object. */ - public function saveInto(ViewableData $model): void + public function saveInto(ModelData $model): void { $fieldName = $this->name; if (empty($fieldName)) { diff --git a/src/ORM/FieldType/DBForeignKey.php b/src/ORM/FieldType/DBForeignKey.php index 5f7d95f55da..c586b891f08 100644 --- a/src/ORM/FieldType/DBForeignKey.php +++ b/src/ORM/FieldType/DBForeignKey.php @@ -10,7 +10,7 @@ use SilverStripe\Forms\SearchableDropdownField; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A special type Int field used for foreign keys in has_one relationships. @@ -58,7 +58,7 @@ public function scaffoldFormField(?string $title = null, array $params = []): ?F return $field; } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { if ($record instanceof DataObject) { $this->object = $record; diff --git a/src/ORM/FieldType/DBInt.php b/src/ORM/FieldType/DBInt.php index 826e0724afb..9aafccb87d3 100644 --- a/src/ORM/FieldType/DBInt.php +++ b/src/ORM/FieldType/DBInt.php @@ -4,10 +4,10 @@ use SilverStripe\Forms\FormField; use SilverStripe\Forms\NumericField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DB; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use Silverstripe\Model\ArrayData; /** * Represents a signed 32 bit integer field. diff --git a/src/ORM/FieldType/DBPercentage.php b/src/ORM/FieldType/DBPercentage.php index cf703e8c140..3ceab526522 100644 --- a/src/ORM/FieldType/DBPercentage.php +++ b/src/ORM/FieldType/DBPercentage.php @@ -2,7 +2,7 @@ namespace SilverStripe\ORM\FieldType; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a decimal field from 0-1 containing a percentage value. @@ -37,7 +37,7 @@ public function Nice(): string return number_format($this->value * 100, $this->decimalSize - 2) . '%'; } - public function saveInto(ViewableData $model): void + public function saveInto(ModelData $model): void { parent::saveInto($model); diff --git a/src/ORM/FieldType/DBPolymorphicForeignKey.php b/src/ORM/FieldType/DBPolymorphicForeignKey.php index 8e5616635f3..62b7926062b 100644 --- a/src/ORM/FieldType/DBPolymorphicForeignKey.php +++ b/src/ORM/FieldType/DBPolymorphicForeignKey.php @@ -4,7 +4,7 @@ use SilverStripe\Forms\FormField; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A special ForeignKey class that handles relations with arbitrary class types @@ -61,7 +61,7 @@ public function setIDValue(int $value, bool $markChanged = true) $this->setField('ID', $value, $markChanged); } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { // Map dataobject value to array if ($value instanceof DataObject) { diff --git a/src/ORM/FieldType/DBPrimaryKey.php b/src/ORM/FieldType/DBPrimaryKey.php index 9a6f7023811..947ebae253e 100644 --- a/src/ORM/FieldType/DBPrimaryKey.php +++ b/src/ORM/FieldType/DBPrimaryKey.php @@ -5,7 +5,7 @@ use SilverStripe\Forms\FormField; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * A special type Int field used for primary keys. @@ -54,7 +54,7 @@ public function scaffoldSearchField(?string $title = null): ?FormField return parent::scaffoldFormField($title); } - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { parent::setValue($value, $record, $markChanged); diff --git a/src/ORM/FieldType/DBTime.php b/src/ORM/FieldType/DBTime.php index 9c64359c349..fac285be19c 100644 --- a/src/ORM/FieldType/DBTime.php +++ b/src/ORM/FieldType/DBTime.php @@ -10,7 +10,7 @@ use SilverStripe\ORM\DB; use SilverStripe\Security\Member; use SilverStripe\Security\Security; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * Represents a column in the database with the type 'Time'. @@ -29,7 +29,7 @@ class DBTime extends DBField */ public const ISO_TIME = 'HH:mm:ss'; - public function setValue(mixed $value, null|array|ViewableData $record = null, bool $markChanged = true): static + public function setValue(mixed $value, null|array|ModelData $record = null, bool $markChanged = true): static { $value = $this->parseTime($value); if ($value === false) { diff --git a/src/ORM/Hierarchy/Hierarchy.php b/src/ORM/Hierarchy/Hierarchy.php index 22fd043552f..929476fc778 100644 --- a/src/ORM/Hierarchy/Hierarchy.php +++ b/src/ORM/Hierarchy/Hierarchy.php @@ -6,9 +6,9 @@ use SilverStripe\Control\Controller; use SilverStripe\Core\ClassInfo; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\Core\Extension; use SilverStripe\ORM\DB; @@ -16,7 +16,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; use Exception; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * DataObjects that use the Hierarchy extension can be be organised as a hierarchy, with children and parents. The most @@ -416,7 +416,7 @@ private function getHierarchyBaseClass(): string { $ancestry = ClassInfo::ancestry($this->owner); $ancestorClass = array_shift($ancestry); - while ($ancestorClass && !ViewableData::has_extension($ancestorClass, Hierarchy::class)) { + while ($ancestorClass && !ModelData::has_extension($ancestorClass, Hierarchy::class)) { $ancestorClass = array_shift($ancestry); } diff --git a/src/ORM/Hierarchy/MarkedSet.php b/src/ORM/Hierarchy/MarkedSet.php index 464480c16fd..0bb4b0fe5a4 100644 --- a/src/ORM/Hierarchy/MarkedSet.php +++ b/src/ORM/Hierarchy/MarkedSet.php @@ -5,12 +5,12 @@ use InvalidArgumentException; use LogicException; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ArrayLib; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Core\ArrayLib; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\SS_List; +use Silverstripe\Model\ArrayData; /** * Contains a set of hierarchical objects generated from a marking compilation run. diff --git a/src/ORM/RelatedData/RelatedDataService.php b/src/ORM/RelatedData/RelatedDataService.php index ecf34460297..6b83c2c419f 100644 --- a/src/ORM/RelatedData/RelatedDataService.php +++ b/src/ORM/RelatedData/RelatedDataService.php @@ -3,7 +3,7 @@ namespace SilverStripe\ORM\RelatedData; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; /** * Interface used to find all other DataObject instances that are related to a DataObject instance diff --git a/src/ORM/RelatedData/StandardRelatedDataService.php b/src/ORM/RelatedData/StandardRelatedDataService.php index c8faa8168f9..7cb43a79376 100644 --- a/src/ORM/RelatedData/StandardRelatedDataService.php +++ b/src/ORM/RelatedData/StandardRelatedDataService.php @@ -6,8 +6,8 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\ORM\DB; -use SilverStripe\ORM\SS_List; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\SS_List; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Connect\Query; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectSchema; diff --git a/src/ORM/Search/BasicSearchContext.php b/src/ORM/Search/BasicSearchContext.php index 9bdd960a187..c7b10685810 100644 --- a/src/ORM/Search/BasicSearchContext.php +++ b/src/ORM/Search/BasicSearchContext.php @@ -8,11 +8,11 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\Deprecation; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Filters\SearchFilter; -use SilverStripe\ORM\Limitable; -use SilverStripe\ORM\Sortable; +use SilverStripe\Model\List\Limitable; +use SilverStripe\Model\List\Sortable; /** * A SearchContext that can be used with non-ORM data. diff --git a/src/ORM/Search/SearchContext.php b/src/ORM/Search/SearchContext.php index 0c6834353e7..4af329f4f5a 100644 --- a/src/ORM/Search/SearchContext.php +++ b/src/ORM/Search/SearchContext.php @@ -11,8 +11,8 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataList; use SilverStripe\ORM\Filters\SearchFilter; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; use SilverStripe\Forms\SelectField; use SilverStripe\Forms\CheckboxField; use InvalidArgumentException; diff --git a/src/Security/AuthenticationHandler.php b/src/Security/AuthenticationHandler.php index c6e532880ea..75ec0f3f69f 100644 --- a/src/Security/AuthenticationHandler.php +++ b/src/Security/AuthenticationHandler.php @@ -3,7 +3,7 @@ namespace SilverStripe\Security; use SilverStripe\Control\HTTPRequest; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; /** * An AuthenticationHandler is responsible for providing an identity (in the form of a Member object) for diff --git a/src/Security/AuthenticationMiddleware.php b/src/Security/AuthenticationMiddleware.php index d4bd88ae07d..ba414253092 100644 --- a/src/Security/AuthenticationMiddleware.php +++ b/src/Security/AuthenticationMiddleware.php @@ -6,7 +6,7 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\Middleware\HTTPMiddleware; use SilverStripe\Core\Config\Configurable; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\ORM\Connect\DatabaseException; class AuthenticationMiddleware implements HTTPMiddleware diff --git a/src/Security/Authenticator.php b/src/Security/Authenticator.php index 856f65654e2..3a8925975e4 100644 --- a/src/Security/Authenticator.php +++ b/src/Security/Authenticator.php @@ -3,7 +3,7 @@ namespace SilverStripe\Security; use SilverStripe\Control\HTTPRequest; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\MemberAuthenticator\LoginHandler; use SilverStripe\Security\MemberAuthenticator\LogoutHandler; diff --git a/src/Security/Confirmation/Form.php b/src/Security/Confirmation/Form.php index 5b214a2715f..f52c663cfc1 100644 --- a/src/Security/Confirmation/Form.php +++ b/src/Security/Confirmation/Form.php @@ -11,7 +11,7 @@ use SilverStripe\Forms\HeaderField; use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\LabelField; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; /** * Basic confirmation form implementation. diff --git a/src/Security/Group.php b/src/Security/Group.php index a8a3a5c5f11..04466000957 100755 --- a/src/Security/Group.php +++ b/src/Security/Group.php @@ -30,7 +30,7 @@ use SilverStripe\Forms\TextField; use SilverStripe\Forms\TreeDropdownField; use SilverStripe\Forms\TreeMultiselectField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\HasManyList; diff --git a/src/Security/Member.php b/src/Security/Member.php index 1b87e2169fb..31933a662f8 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -23,18 +23,18 @@ use SilverStripe\Forms\Tab; use SilverStripe\Forms\TabSet; use SilverStripe\i18n\i18n; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\HasManyList; use SilverStripe\ORM\ManyManyList; -use SilverStripe\ORM\Map; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\Map; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\UnsavedRelationList; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use Symfony\Component\Mailer\Exception\TransportExceptionInterface; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Exception\RfcComplianceException; diff --git a/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php b/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php index 467823b4d1b..bdc93e422ad 100644 --- a/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php +++ b/src/Security/MemberAuthenticator/CMSMemberAuthenticator.php @@ -2,7 +2,7 @@ namespace SilverStripe\Security\MemberAuthenticator; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator as BaseAuthenticator; use SilverStripe\Security\Member; diff --git a/src/Security/MemberAuthenticator/ChangePasswordHandler.php b/src/Security/MemberAuthenticator/ChangePasswordHandler.php index bd027ba8de5..a2ec7b8c3ac 100644 --- a/src/Security/MemberAuthenticator/ChangePasswordHandler.php +++ b/src/Security/MemberAuthenticator/ChangePasswordHandler.php @@ -10,7 +10,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Authenticator; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\LoginAttempt; diff --git a/src/Security/MemberAuthenticator/LoginHandler.php b/src/Security/MemberAuthenticator/LoginHandler.php index db672e11c46..d7604da9c0b 100644 --- a/src/Security/MemberAuthenticator/LoginHandler.php +++ b/src/Security/MemberAuthenticator/LoginHandler.php @@ -7,7 +7,7 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\RequestHandler; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\PasswordExpirationMiddleware; use SilverStripe\Security\IdentityStore; diff --git a/src/Security/MemberAuthenticator/LogoutHandler.php b/src/Security/MemberAuthenticator/LogoutHandler.php index 9b870a259f5..99c83fba4e5 100644 --- a/src/Security/MemberAuthenticator/LogoutHandler.php +++ b/src/Security/MemberAuthenticator/LogoutHandler.php @@ -7,7 +7,7 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\RequestHandler; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\LogoutForm; use SilverStripe\Security\Member; diff --git a/src/Security/MemberAuthenticator/MemberAuthenticator.php b/src/Security/MemberAuthenticator/MemberAuthenticator.php index ec53cffebd5..b8aeee7c468 100644 --- a/src/Security/MemberAuthenticator/MemberAuthenticator.php +++ b/src/Security/MemberAuthenticator/MemberAuthenticator.php @@ -5,7 +5,7 @@ use InvalidArgumentException; use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\Extensible; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\LoginAttempt; diff --git a/src/Security/MemberAuthenticator/MemberLoginForm.php b/src/Security/MemberAuthenticator/MemberLoginForm.php index 8ce5c2b4b99..c88df53dc87 100644 --- a/src/Security/MemberAuthenticator/MemberLoginForm.php +++ b/src/Security/MemberAuthenticator/MemberLoginForm.php @@ -12,7 +12,7 @@ use SilverStripe\Forms\PasswordField; use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\LoginForm as BaseLoginForm; use SilverStripe\Security\Member; use SilverStripe\Security\RememberLoginHash; diff --git a/src/Security/PasswordValidator.php b/src/Security/PasswordValidator.php index 62288201dc0..8ab6482efc9 100644 --- a/src/Security/PasswordValidator.php +++ b/src/Security/PasswordValidator.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Extensible; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * This class represents a validator for member passwords. diff --git a/src/Security/Permission.php b/src/Security/Permission.php index 4bf6dd5bf94..0fec4b75207 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -6,10 +6,10 @@ use SilverStripe\Core\Resettable; use SilverStripe\Dev\TestOnly; use SilverStripe\i18n\i18nEntityProvider; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\View\TemplateGlobalProvider; /** @@ -375,7 +375,7 @@ public static function groupList($memberID = null) public static function grant($groupID, $code, $arg = "any") { $permissions = Permission::get()->filter(['GroupID' => $groupID, 'Code' => $code]); - + if ($permissions && $permissions->count() > 0) { $perm = $permissions->last(); } else { diff --git a/src/Security/PermissionCheckboxSetField.php b/src/Security/PermissionCheckboxSetField.php index 252cd9af1cb..bad09fa4f3b 100644 --- a/src/Security/PermissionCheckboxSetField.php +++ b/src/Security/PermissionCheckboxSetField.php @@ -5,10 +5,10 @@ use InvalidArgumentException; use SilverStripe\Core\Config\Config; use SilverStripe\Forms\FormField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use Traversable; /** diff --git a/src/Security/Security.php b/src/Security/Security.php index 80d6fe8d4bb..af55f413cef 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -18,13 +18,13 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\Form; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; -use SilverStripe\ORM\ValidationResult; -use SilverStripe\View\ArrayData; +use SilverStripe\Core\Validation\ValidationResult; +use Silverstripe\Model\ArrayData; use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; use SilverStripe\View\TemplateGlobalProvider; diff --git a/src/View/AttributesHTML.php b/src/View/AttributesHTML.php index 88295046a63..2eccfac20fe 100644 --- a/src/View/AttributesHTML.php +++ b/src/View/AttributesHTML.php @@ -5,7 +5,7 @@ use SilverStripe\Core\Convert; /** - * This trait can be applied to a ViewableData class to add the logic to render attributes in an SS template. + * This trait can be applied to a ModelData class to add the logic to render attributes in an SS template. * * When applying this trait to a class, you also need to add the following casting configuration. * ``` diff --git a/src/View/Parsers/HTMLValue.php b/src/View/Parsers/HTMLValue.php index c8c0779b34e..f7accf29542 100644 --- a/src/View/Parsers/HTMLValue.php +++ b/src/View/Parsers/HTMLValue.php @@ -3,7 +3,7 @@ namespace SilverStripe\View\Parsers; use SilverStripe\Core\Convert; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Masterminds\HTML5; use DOMNodeList; use DOMXPath; @@ -16,7 +16,7 @@ * * @mixin DOMDocument */ -class HTMLValue extends ViewableData +class HTMLValue extends ModelData { public function __construct($fragment = null) { diff --git a/src/View/SSTemplateParser.peg b/src/View/SSTemplateParser.peg index 628c4150bde..b893ef4ae5e 100644 --- a/src/View/SSTemplateParser.peg +++ b/src/View/SSTemplateParser.peg @@ -275,7 +275,7 @@ class SSTemplateParser extends Parser implements TemplateParser /** * The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to - * get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) + * get the next ModelData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) * depending on the context the lookup is used in. */ function Lookup_AddLookupStep(&$res, $sub, $method) diff --git a/src/View/SSTemplateParser.php b/src/View/SSTemplateParser.php index d9e1e15323b..4e48424898a 100644 --- a/src/View/SSTemplateParser.php +++ b/src/View/SSTemplateParser.php @@ -766,7 +766,7 @@ function Lookup__construct(&$res) /** * The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to - * get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) + * get the next ModelData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) * depending on the context the lookup is used in. */ function Lookup_AddLookupStep(&$res, $sub, $method) @@ -1187,7 +1187,7 @@ function match_QuotedString ($stack = array()) { $matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null); $_154 = NULL; do { - $stack[] = $result; $result = $this->construct( $matchrule, "q" ); + $stack[] = $result; $result = $this->construct( $matchrule, "q" ); if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -1197,7 +1197,7 @@ function match_QuotedString ($stack = array()) { $result = array_pop($stack); $_154 = FALSE; break; } - $stack[] = $result; $result = $this->construct( $matchrule, "String" ); + $stack[] = $result; $result = $this->construct( $matchrule, "String" ); if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -1840,7 +1840,7 @@ function match_PresenceCheck ($stack = array()) { $pos_255 = $this->pos; $_254 = NULL; do { - $stack[] = $result; $result = $this->construct( $matchrule, "Not" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Not" ); if (( $subres = $this->literal( 'not' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -2235,7 +2235,7 @@ function match_Require ($stack = array()) { else { $_330 = FALSE; break; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } else { $_330 = FALSE; break; } - $stack[] = $result; $result = $this->construct( $matchrule, "Call" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Call" ); $_326 = NULL; do { $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; @@ -2740,7 +2740,7 @@ function match_UncachedBlock ($stack = array()) { $_423 = NULL; do { if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); $_419 = NULL; do { $_417 = NULL; @@ -3166,7 +3166,7 @@ function match_CacheBlock ($stack = array()) { if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } else { $_555 = FALSE; break; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); + $stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); $_508 = NULL; do { $_506 = NULL; @@ -3225,7 +3225,7 @@ function match_CacheBlock ($stack = array()) { $_524 = NULL; do { if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); $_520 = NULL; do { $_518 = NULL; @@ -4165,7 +4165,7 @@ function match_ClosedBlock ($stack = array()) { unset( $pos_685 ); } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; $subres = $result; $result = array_pop($stack); @@ -4575,7 +4575,7 @@ function match_MalformedCloseTag ($stack = array()) { if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } else { $_743 = FALSE; break; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } - $stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); + $stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); $_737 = NULL; do { if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } diff --git a/src/View/SSViewer.php b/src/View/SSViewer.php index 3b82eb3fdd9..730e663dc10 100644 --- a/src/View/SSViewer.php +++ b/src/View/SSViewer.php @@ -324,7 +324,7 @@ public static function get_templates_by_class($classOrObject, $suffix = '', $bas /** * Get the current item being processed * - * @return ViewableData + * @return ModelData */ public static function topLevel() { @@ -549,10 +549,10 @@ public function includeRequirements($incl = true) * Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call * * @param string $cacheFile The path to the file that contains the template compiled to PHP - * @param ViewableData $item The item to use as the root scope for the template + * @param ModelData $item The item to use as the root scope for the template * @param array $overlay Any variables to layer on top of the scope * @param array $underlay Any variables to layer underneath the scope - * @param ViewableData $inheritedScope The current scope of a parent template including a sub-template + * @param ModelData $inheritedScope The current scope of a parent template including a sub-template * @return string The result of executing the template */ protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null) @@ -587,11 +587,11 @@ protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underl * * The method injects extra HTML in the header via {@link Requirements::includeInHTML()}. * - * Note: You can call this method indirectly by {@link ViewableData->renderWith()}. + * Note: You can call this method indirectly by {@link ModelData->renderWith()}. * - * @param ViewableData $item + * @param ModelData $item * @param array|null $arguments Arguments to an included template - * @param ViewableData $inheritedScope The current scope of a parent template including a sub-template + * @param ModelData $inheritedScope The current scope of a parent template including a sub-template * @return DBHTMLText Parsed template output. */ public function process($item, $arguments = null, $inheritedScope = null) diff --git a/src/View/SSViewer_BasicIteratorSupport.php b/src/View/SSViewer_BasicIteratorSupport.php index 074c8d71dc8..99d02106b96 100644 --- a/src/View/SSViewer_BasicIteratorSupport.php +++ b/src/View/SSViewer_BasicIteratorSupport.php @@ -4,7 +4,7 @@ /** * Defines an extra set of basic methods that can be used in templates - * that are not defined on sub-classes of {@link ViewableData}. + * that are not defined on sub-classes of {@link ModelData}. */ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider { diff --git a/src/View/SSViewer_DataPresenter.php b/src/View/SSViewer_DataPresenter.php index 7c5b6e5ecd0..ae2fd4e8426 100644 --- a/src/View/SSViewer_DataPresenter.php +++ b/src/View/SSViewer_DataPresenter.php @@ -130,7 +130,7 @@ protected function getPropertiesFromProvider($interfaceToQuery, $variableMethod, if (!is_array($details)) { $details = [ 'method' => $details, - 'casting' => ViewableData::config()->uninherited('default_cast') + 'casting' => ModelData::config()->uninherited('default_cast') ]; } @@ -313,7 +313,7 @@ public function __call($name, $arguments) if ($val) { $obj = $val['obj']; if ($name === 'hasValue') { - $result = ($obj instanceof ViewableData) ? $obj->exists() : (bool)$obj; + $result = ($obj instanceof ModelData) ? $obj->exists() : (bool)$obj; } elseif (is_null($obj) || (is_scalar($obj) && !is_string($obj))) { $result = $obj; // Nulls and non-string scalars don't need casting } else { @@ -434,7 +434,7 @@ protected function castValue($value, $source) // Get provided or default cast $casting = empty($source['casting']) - ? ViewableData::config()->uninherited('default_cast') + ? ModelData::config()->uninherited('default_cast') : $source['casting']; return DBField::create_field($casting, $value); diff --git a/src/View/SSViewer_Scope.php b/src/View/SSViewer_Scope.php index 3cefaa75fe0..928b7b4a338 100644 --- a/src/View/SSViewer_Scope.php +++ b/src/View/SSViewer_Scope.php @@ -5,7 +5,7 @@ use ArrayIterator; use Countable; use Iterator; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBBoolean; use SilverStripe\ORM\FieldType\DBText; use SilverStripe\ORM\FieldType\DBFloat; @@ -16,7 +16,7 @@ * This tracks the current scope for an SSViewer instance. It has three goals: * - Handle entering & leaving sub-scopes in loops and withs * - Track Up and Top - * - (As a side effect) Inject data that needs to be available globally (used to live in ViewableData) + * - (As a side effect) Inject data that needs to be available globally (used to live in ModelData) * * In order to handle up, rather than tracking it using a tree, which would involve constructing new objects * for each step, we use indexes into the itemStack (which already has to exist). @@ -132,7 +132,7 @@ public function getItem() $item = $this->convertScalarToDBField($item); } - // Wrap list arrays in ViewableData so templates can handle them + // Wrap list arrays in ModelData so templates can handle them if (is_array($item) && array_is_list($item)) { $item = ArrayList::create($item); } diff --git a/src/View/Shortcodes/EmbedShortcodeProvider.php b/src/View/Shortcodes/EmbedShortcodeProvider.php index 89806d6bc26..42156b93e61 100644 --- a/src/View/Shortcodes/EmbedShortcodeProvider.php +++ b/src/View/Shortcodes/EmbedShortcodeProvider.php @@ -8,9 +8,9 @@ use Psr\SimpleCache\InvalidArgumentException; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injector; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\Embed\Embeddable; use SilverStripe\View\HTML; use SilverStripe\View\Parsers\ShortcodeHandler; diff --git a/src/View/TemplateGlobalProvider.php b/src/View/TemplateGlobalProvider.php index d1363df5b32..84b6d7ea416 100644 --- a/src/View/TemplateGlobalProvider.php +++ b/src/View/TemplateGlobalProvider.php @@ -19,7 +19,7 @@ interface TemplateGlobalProvider * If the method to call is not included for a particular template variable, a method named the same as the * template variable will be called * - * If the casting class is not specified for a particular template variable, ViewableData::$default_cast is used + * If the casting class is not specified for a particular template variable, ModelData::$default_cast is used * * The first letter of the template variable is case-insensitive. However the method name is always case sensitive. * diff --git a/src/View/TemplateIteratorProvider.php b/src/View/TemplateIteratorProvider.php index f2930bc62fd..a3169afadd7 100644 --- a/src/View/TemplateIteratorProvider.php +++ b/src/View/TemplateIteratorProvider.php @@ -19,7 +19,7 @@ interface TemplateIteratorProvider * If the method to call is not included for a particular template variable, a method named the same as the * template variable will be called * - * If the casting class is not specified for a particular template variable, ViewableData::$default_cast is used + * If the casting class is not specified for a particular template variable, ModelData::$default_cast is used * * The first letter of the template variable is case-insensitive. However the method name is always case sensitive. * diff --git a/tests/php/Control/Email/EmailTest.php b/tests/php/Control/Email/EmailTest.php index 699d910b63f..2aec4bbd72a 100644 --- a/tests/php/Control/Email/EmailTest.php +++ b/tests/php/Control/Email/EmailTest.php @@ -11,7 +11,7 @@ use SilverStripe\Dev\TestMailer; use SilverStripe\Security\Member; use SilverStripe\View\SSViewer; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Part\DataPart; @@ -397,12 +397,12 @@ public function testDataWithArray(): void $this->assertSame('My content', $email->getData()->Content); } - public function testDataWithViewableData(): void + public function testDataWithModelData(): void { $email = new Email(); - $viewableData = new ViewableData(); - $viewableData->ABC = 'XYZ'; - $email->setData($viewableData); + $model = new ModelData(); + $model->ABC = 'XYZ'; + $email->setData($model); $data = $email->getData(); $this->assertSame('XYZ', $data->ABC); $this->assertSame(true, $data->IsEmail); diff --git a/tests/php/Control/RSS/RSSFeedTest.php b/tests/php/Control/RSS/RSSFeedTest.php index 8392dd49599..ac831f655f5 100644 --- a/tests/php/Control/RSS/RSSFeedTest.php +++ b/tests/php/Control/RSS/RSSFeedTest.php @@ -6,7 +6,7 @@ use SilverStripe\Control\RSS\RSSFeed; use SilverStripe\Core\Config\Config; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\View\Parsers\ShortcodeParser; class RSSFeedTest extends SapphireTest diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemA.php b/tests/php/Control/RSS/RSSFeedTest/ItemA.php index 78a69dc05f6..cdce0415f3f 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemA.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemA.php @@ -3,9 +3,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; use SilverStripe\Control\Controller; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemA extends ViewableData +class ItemA extends ModelData { // RSS-feed items must have $casting/$db information. private static $casting = [ diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemB.php b/tests/php/Control/RSS/RSSFeedTest/ItemB.php index 87c33118d0d..ee0f604ac56 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemB.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemB.php @@ -2,9 +2,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemB extends ViewableData +class ItemB extends ModelData { // ItemB tests without $casting diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemC.php b/tests/php/Control/RSS/RSSFeedTest/ItemC.php index 0edcd9adaa5..17011648b7b 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemC.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemC.php @@ -2,9 +2,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemC extends ViewableData +class ItemC extends ModelData { // ItemC tests fields - Title has casting, Content doesn't. private static $casting = [ diff --git a/tests/php/Control/RSS/RSSFeedTest/ItemD.php b/tests/php/Control/RSS/RSSFeedTest/ItemD.php index c44914b602f..323444620aa 100644 --- a/tests/php/Control/RSS/RSSFeedTest/ItemD.php +++ b/tests/php/Control/RSS/RSSFeedTest/ItemD.php @@ -2,9 +2,9 @@ namespace SilverStripe\Control\Tests\RSS\RSSFeedTest; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ItemD extends ViewableData +class ItemD extends ModelData { // ItemD test fields - all fields use casting but Content & AltContent cast as HTMLText private static $casting = [ diff --git a/tests/php/Control/RequestHandlingTest/ControllerFailover.php b/tests/php/Control/RequestHandlingTest/ControllerFailover.php index 846458f1583..bf90fbf84fd 100644 --- a/tests/php/Control/RequestHandlingTest/ControllerFailover.php +++ b/tests/php/Control/RequestHandlingTest/ControllerFailover.php @@ -3,9 +3,9 @@ namespace SilverStripe\Control\Tests\RequestHandlingTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; -class ControllerFailover extends ViewableData implements TestOnly +class ControllerFailover extends ModelData implements TestOnly { public function failoverMethod() { diff --git a/tests/php/ORM/ArrayLibTest.php b/tests/php/Core/ArrayLibTest.php similarity index 99% rename from tests/php/ORM/ArrayLibTest.php rename to tests/php/Core/ArrayLibTest.php index d22e871e7ab..3f33a099bd0 100644 --- a/tests/php/ORM/ArrayLibTest.php +++ b/tests/php/Core/ArrayLibTest.php @@ -3,7 +3,7 @@ namespace SilverStripe\ORM\Tests; use PHPUnit\Framework\ExpectationFailedException; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\Dev\SapphireTest; class ArrayLibTest extends SapphireTest diff --git a/tests/php/Core/ClassInfoTest.php b/tests/php/Core/ClassInfoTest.php index 7528c3f3661..b67e54bb0c9 100644 --- a/tests/php/Core/ClassInfoTest.php +++ b/tests/php/Core/ClassInfoTest.php @@ -23,7 +23,7 @@ use SilverStripe\Core\Tests\ClassInfoTest\WithRelation; use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; class ClassInfoTest extends SapphireTest { @@ -152,7 +152,7 @@ public function testAncestry() { $ancestry = ClassInfo::ancestry(ChildClass::class); $expect = [ - 'silverstripe\\view\\viewabledata' => ViewableData::class, + 'silverstripe\\model\\modeldata' => ModelData::class, 'silverstripe\\orm\\dataobject' => DataObject::class, 'silverstripe\\core\tests\classinfotest\\baseclass' => BaseClass::class, 'silverstripe\\core\tests\classinfotest\\childclass' => ChildClass::class, diff --git a/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php b/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php index 9dd413cbfb6..1c7dfd8da3a 100644 --- a/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php +++ b/tests/php/Core/Injector/InjectorTest/TestSetterInjections.php @@ -3,12 +3,12 @@ namespace SilverStripe\Core\Tests\Injector\InjectorTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** - * Make sure DI works with ViewableData's implementation of __isset + * Make sure DI works with ModelData's implementation of __isset */ -class TestSetterInjections extends ViewableData implements TestOnly +class TestSetterInjections extends ModelData implements TestOnly { protected $backend; diff --git a/tests/php/ORM/ValidationExceptionTest.php b/tests/php/Core/Validation/ValidationExceptionTest.php similarity index 98% rename from tests/php/ORM/ValidationExceptionTest.php rename to tests/php/Core/Validation/ValidationExceptionTest.php index 28253e297fb..dbc23b1de33 100644 --- a/tests/php/ORM/ValidationExceptionTest.php +++ b/tests/php/Core/Validation/ValidationExceptionTest.php @@ -1,9 +1,9 @@ 'Ingo', @@ -53,7 +53,7 @@ public function provideInvalidMatchesForList() */ public function testEvaluateMatchesCorrectlyArrayData($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = ArrayData::create($this->test_data); @@ -67,7 +67,7 @@ public function testEvaluateMatchesCorrectlyArrayData($match) */ public function testEvaluateMatchesCorrectlyDataObject($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = Member::create($this->test_data); @@ -81,7 +81,7 @@ public function testEvaluateMatchesCorrectlyDataObject($match) */ public function testEvaluateDoesNotMatchWrongMatchInArrayData($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = ArrayData::create($this->test_data); @@ -95,7 +95,7 @@ public function testEvaluateDoesNotMatchWrongMatchInArrayData($match) */ public function testEvaluateDoesNotMatchWrongMatchInDataObject($match) { - $constraint = new ViewableDataContains($match); + $constraint = new ModelDataContains($match); $item = Member::create($this->test_data); @@ -105,10 +105,10 @@ public function testEvaluateDoesNotMatchWrongMatchInDataObject($match) public function testFieldAccess() { $data = new TestObject(['name' => 'Damian']); - $constraint = new ViewableDataContains(['name' => 'Damian', 'Something' => 'something']); + $constraint = new ModelDataContains(['name' => 'Damian', 'Something' => 'something']); $this->assertTrue($constraint->evaluate($data, '', true)); - $constraint = new ViewableDataContains(['name' => 'Damian', 'Something' => 'notthing']); + $constraint = new ModelDataContains(['name' => 'Damian', 'Something' => 'notthing']); $this->assertFalse($constraint->evaluate($data, '', true)); } } diff --git a/tests/php/Dev/ViewableDataContainsTest/TestObject.php b/tests/php/Dev/ViewableDataContainsTest/TestObject.php index 658cae21040..70a16e723fd 100644 --- a/tests/php/Dev/ViewableDataContainsTest/TestObject.php +++ b/tests/php/Dev/ViewableDataContainsTest/TestObject.php @@ -1,11 +1,11 @@ method('getHTMLID') ->willReturn($formName); - + $source = [ 'first' => 'value', 0 => 'otherValue' diff --git a/tests/php/Forms/EmailFieldTest/TestValidator.php b/tests/php/Forms/EmailFieldTest/TestValidator.php index f3557d83414..21e00a989aa 100644 --- a/tests/php/Forms/EmailFieldTest/TestValidator.php +++ b/tests/php/Forms/EmailFieldTest/TestValidator.php @@ -4,7 +4,7 @@ use Exception; use SilverStripe\Forms\Validator; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; class TestValidator extends Validator { diff --git a/tests/php/Forms/EnumFieldTest.php b/tests/php/Forms/EnumFieldTest.php index deb3d69be55..8e77426ff2b 100644 --- a/tests/php/Forms/EnumFieldTest.php +++ b/tests/php/Forms/EnumFieldTest.php @@ -2,7 +2,7 @@ namespace SilverStripe\Forms\Tests; -use SilverStripe\ORM\ArrayLib; +use SilverStripe\Core\ArrayLib; use SilverStripe\ORM\FieldType\DBEnum; use SilverStripe\Dev\SapphireTest; diff --git a/tests/php/Forms/FormFieldTest.php b/tests/php/Forms/FormFieldTest.php index 21b4a01283a..b956ab7407c 100644 --- a/tests/php/Forms/FormFieldTest.php +++ b/tests/php/Forms/FormFieldTest.php @@ -31,7 +31,7 @@ use SilverStripe\Forms\ToggleCompositeField; use SilverStripe\Forms\TreeDropdownField; use SilverStripe\Forms\TreeDropdownField_Readonly; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Group; use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionCheckboxSetField; diff --git a/tests/php/Forms/FormTest.php b/tests/php/Forms/FormTest.php index 8b97293443a..8742148cd64 100644 --- a/tests/php/Forms/FormTest.php +++ b/tests/php/Forms/FormTest.php @@ -27,11 +27,11 @@ use SilverStripe\Forms\TextareaField; use SilverStripe\Forms\TextField; use SilverStripe\Forms\TimeField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\NullSecurityToken; use SilverStripe\Security\RandomGenerator; use SilverStripe\Security\SecurityToken; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\SSViewer; class FormTest extends FunctionalTest @@ -766,9 +766,9 @@ public function testSubmitFormWithSpecifiedParameters( ): void { $this->get('FormTest_ControllerWithSecurityToken'); - + [ $form, $button, $data, $withSecurityToken ] = [ ...$formData ]; - + if (is_null($button)) { $response = $this->submitForm($form, $button, $data, $withSecurityToken); $this->assertEquals($statusCode, $response->getStatusCode(), $testMessage); diff --git a/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php b/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php index a39626d37e5..538261bd6c9 100644 --- a/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php +++ b/tests/php/Forms/FormTest/ControllerWithSpecialSubmittedValueFields.php @@ -14,8 +14,8 @@ use SilverStripe\Forms\NumericField; use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\View\SSViewer; class ControllerWithSpecialSubmittedValueFields extends Controller implements TestOnly diff --git a/tests/php/Forms/FormTest/TestController.php b/tests/php/Forms/FormTest/TestController.php index 4e514d83da9..a9ca0a1259d 100644 --- a/tests/php/Forms/FormTest/TestController.php +++ b/tests/php/Forms/FormTest/TestController.php @@ -13,8 +13,8 @@ use SilverStripe\Forms\NumericField; use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\TextField; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\View\SSViewer; class TestController extends Controller implements TestOnly diff --git a/tests/php/Forms/GridField/GridFieldActionMenuTest.php b/tests/php/Forms/GridField/GridFieldActionMenuTest.php index 118b092bf45..2e8c5e43756 100644 --- a/tests/php/Forms/GridField/GridFieldActionMenuTest.php +++ b/tests/php/Forms/GridField/GridFieldActionMenuTest.php @@ -17,7 +17,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\Security\Member; use SilverStripe\Security\Security; diff --git a/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php b/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php index e58d30837a5..0b3e5aafc5a 100644 --- a/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php +++ b/tests/php/Forms/GridField/GridFieldAddExistingAutocompleterTest.php @@ -17,8 +17,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Stadium; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; class GridFieldAddExistingAutocompleterTest extends FunctionalTest { diff --git a/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php b/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php index 900c490e27e..d53b7fd1e23 100644 --- a/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldAddNewButtonTest.php @@ -15,9 +15,9 @@ use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PeopleGroup; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Category; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\SS_List; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\SS_List; +use Silverstripe\Model\ArrayData; class GridFieldAddNewButtonTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldConfigTest.php b/tests/php/Forms/GridField/GridFieldConfigTest.php index 669fcb09717..7cc7c4d7ced 100644 --- a/tests/php/Forms/GridField/GridFieldConfigTest.php +++ b/tests/php/Forms/GridField/GridFieldConfigTest.php @@ -4,7 +4,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyOtherComponent; use SilverStripe\Forms\Tests\GridField\GridFieldConfigTest\MyComponent; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\Forms\GridField\GridField_URLHandler; diff --git a/tests/php/Forms/GridField/GridFieldDataColumnsTest.php b/tests/php/Forms/GridField/GridFieldDataColumnsTest.php index b9e0c039796..2e446b60e13 100644 --- a/tests/php/Forms/GridField/GridFieldDataColumnsTest.php +++ b/tests/php/Forms/GridField/GridFieldDataColumnsTest.php @@ -9,8 +9,8 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldConfig_Base; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; use stdClass; class GridFieldDataColumnsTest extends SapphireTest diff --git a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php index 8786d20bdad..34f0370f1b8 100644 --- a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php +++ b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php @@ -20,12 +20,12 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Security; use SilverStripe\Security\SecurityToken; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class GridFieldDeleteActionTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldDetailFormTest.php b/tests/php/Forms/GridField/GridFieldDetailFormTest.php index 34c1848c1d9..c25ab1ba585 100644 --- a/tests/php/Forms/GridField/GridFieldDetailFormTest.php +++ b/tests/php/Forms/GridField/GridFieldDetailFormTest.php @@ -24,8 +24,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\Person; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\PolymorphicPeopleGroup; use SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest\TestController; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; class GridFieldDetailFormTest extends FunctionalTest { diff --git a/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php b/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php index 00fed3896c1..ec3ab1ef4f5 100644 --- a/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php +++ b/tests/php/Forms/GridField/GridFieldDetailFormTest/ArrayDataWithID.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\Tests\GridField\GridFieldDetailFormTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class ArrayDataWithID extends ArrayData implements TestOnly { diff --git a/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php b/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php index a50715e7377..431a5bdba43 100644 --- a/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php +++ b/tests/php/Forms/GridField/GridFieldDetailFormTest/TestController.php @@ -13,7 +13,7 @@ use SilverStripe\Forms\GridField\GridFieldEditButton; use SilverStripe\Forms\GridField\GridFieldToolbarHeader; use SilverStripe\Forms\GridField\GridFieldViewButton; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; class TestController extends Controller implements TestOnly { diff --git a/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php b/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php index 0a13a074970..e92fd954872 100644 --- a/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php +++ b/tests/php/Forms/GridField/GridFieldDetailForm_ItemRequestTest.php @@ -9,8 +9,8 @@ use SilverStripe\Forms\GridField\GridFieldConfig_Base; use SilverStripe\Forms\GridField\GridFieldDetailForm; use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; class GridFieldDetailForm_ItemRequestTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldEditButtonTest.php b/tests/php/Forms/GridField/GridFieldEditButtonTest.php index 1d9807bfd0b..c650b7a1995 100644 --- a/tests/php/Forms/GridField/GridFieldEditButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldEditButtonTest.php @@ -6,7 +6,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\Security\Member; use SilverStripe\Dev\CSSContentParser; diff --git a/tests/php/Forms/GridField/GridFieldExportButtonTest.php b/tests/php/Forms/GridField/GridFieldExportButtonTest.php index 2f4c9078c59..17c77a6d744 100644 --- a/tests/php/Forms/GridField/GridFieldExportButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldExportButtonTest.php @@ -8,7 +8,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\NoView; use SilverStripe\Forms\Tests\GridField\GridFieldExportButtonTest\Team; use SilverStripe\ORM\DataList; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridFieldConfig; @@ -17,7 +17,7 @@ use SilverStripe\Forms\GridField\GridFieldDataColumns; use SilverStripe\Forms\GridField\GridFieldPaginator; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class GridFieldExportButtonTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php b/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php index 2a760c25ade..e594effb2e6 100644 --- a/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php +++ b/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php @@ -18,10 +18,10 @@ use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\NonDataObject; use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\Team; use SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest\TeamGroup; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class GridFieldFilterHeaderTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php b/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php index c446dddfcda..bcbb98a714b 100644 --- a/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php +++ b/tests/php/Forms/GridField/GridFieldFilterHeaderTest/NonDataObject.php @@ -3,7 +3,7 @@ namespace SilverStripe\Forms\Tests\GridField\GridFieldFilterHeaderTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class NonDataObject extends ArrayData implements TestOnly { diff --git a/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php b/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php index 9789fe08c49..20ab42fc596 100644 --- a/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php +++ b/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php @@ -15,7 +15,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Permissions; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; class GridFieldLazyLoaderTest extends SapphireTest diff --git a/tests/php/Forms/GridField/GridFieldLevelupTest.php b/tests/php/Forms/GridField/GridFieldLevelupTest.php index ffa7eeccbac..45c44565a51 100644 --- a/tests/php/Forms/GridField/GridFieldLevelupTest.php +++ b/tests/php/Forms/GridField/GridFieldLevelupTest.php @@ -6,7 +6,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldLevelup; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class GridFieldLevelupTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldPaginatorTest.php b/tests/php/Forms/GridField/GridFieldPaginatorTest.php index 6f6dc53a34f..f2febae4b1a 100644 --- a/tests/php/Forms/GridField/GridFieldPaginatorTest.php +++ b/tests/php/Forms/GridField/GridFieldPaginatorTest.php @@ -15,7 +15,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataList; class GridFieldPaginatorTest extends FunctionalTest diff --git a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php index 8b9b2f61d2b..9510ecd7e9a 100644 --- a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php @@ -14,8 +14,8 @@ use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldDataColumns; use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; class GridFieldPrintButtonTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldStateManagerTest.php b/tests/php/Forms/GridField/GridFieldStateManagerTest.php index 2e376d713ef..8de98ca823b 100644 --- a/tests/php/Forms/GridField/GridFieldStateManagerTest.php +++ b/tests/php/Forms/GridField/GridFieldStateManagerTest.php @@ -12,7 +12,7 @@ use SilverStripe\Forms\GridField\GridFieldStateManager; use SilverStripe\Forms\Form; use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class GridFieldStateManagerTest extends SapphireTest { diff --git a/tests/php/Forms/GridField/GridFieldTest.php b/tests/php/Forms/GridField/GridFieldTest.php index 642460aa5ac..616fa78c6d6 100644 --- a/tests/php/Forms/GridField/GridFieldTest.php +++ b/tests/php/Forms/GridField/GridFieldTest.php @@ -33,8 +33,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player; use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\Forms\Tests\ValidatorTest\TestValidator; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Group; use SilverStripe\Security\Member; use SilverStripe\Versioned\VersionedGridFieldStateExtension; diff --git a/tests/php/Forms/GridField/GridFieldTest/Component2.php b/tests/php/Forms/GridField/GridFieldTest/Component2.php index 2daedd522b8..d011a04b810 100644 --- a/tests/php/Forms/GridField/GridFieldTest/Component2.php +++ b/tests/php/Forms/GridField/GridFieldTest/Component2.php @@ -5,8 +5,8 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField_DataManipulator; -use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\List\SS_List; class Component2 implements GridField_DataManipulator, TestOnly { diff --git a/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php b/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php index 01792bc41c1..4cbdc184a42 100644 --- a/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php +++ b/tests/php/Forms/GridField/GridField_URLHandlerTest/TestController.php @@ -8,7 +8,7 @@ use SilverStripe\Forms\Form; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldConfig; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; class TestController extends Controller implements TestOnly { diff --git a/tests/php/Forms/ListboxFieldTest.php b/tests/php/Forms/ListboxFieldTest.php index 085b0758fac..292889b0b6d 100644 --- a/tests/php/Forms/ListboxFieldTest.php +++ b/tests/php/Forms/ListboxFieldTest.php @@ -10,7 +10,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\ListboxField; use SilverStripe\Forms\RequiredFields; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class ListboxFieldTest extends SapphireTest { diff --git a/tests/php/View/ArrayDataTest.php b/tests/php/Model/ArrayDataTest.php similarity index 89% rename from tests/php/View/ArrayDataTest.php rename to tests/php/Model/ArrayDataTest.php index 4ac60b1306a..cb25d6aad7e 100644 --- a/tests/php/View/ArrayDataTest.php +++ b/tests/php/Model/ArrayDataTest.php @@ -1,19 +1,19 @@ new DBVarchar("A"), diff --git a/tests/php/View/ArrayDataTest/NonEmptyObject.php b/tests/php/Model/ArrayDataTest/NonEmptyObject.php similarity index 83% rename from tests/php/View/ArrayDataTest/NonEmptyObject.php rename to tests/php/Model/ArrayDataTest/NonEmptyObject.php index da4cc57e2a0..67b7c5c9821 100644 --- a/tests/php/View/ArrayDataTest/NonEmptyObject.php +++ b/tests/php/Model/ArrayDataTest/NonEmptyObject.php @@ -1,6 +1,6 @@ assertEquals('Team 1', $map[$this->idFromFixture(DataObjectTest\Team::class, 'team1')]); + $this->assertEquals('Team 1', $map[$this->idFromFixture(Team::class, 'team1')]); } public function testSetKeyFieldAndValueField() diff --git a/tests/php/Model/List/MapTest.yml b/tests/php/Model/List/MapTest.yml new file mode 100644 index 00000000000..3b9c8a4e0cf --- /dev/null +++ b/tests/php/Model/List/MapTest.yml @@ -0,0 +1,32 @@ +SilverStripe\Model\Tests\List\MapTest\Team: + team1: + Title: Team 1 + NumericField: 2 + team2: + Title: Team 2 + NumericField: 20 + team3: + Title: Team 3 + NumericField: 5 +SilverStripe\Model\Tests\List\MapTest\SubTeam: + subteam1: + Title: Subteam 1 + NumericField: 7 + ParentTeam: =>SilverStripe\Model\Tests\List\MapTest\Team.team1 + subteam2_with_player_relation: + Title: Subteam 2 + subteam3_with_empty_fields: + Title: Subteam 3 +SilverStripe\Model\Tests\List\MapTest\TeamComment: + comment1: + Name: Joe + Comment: This is a team comment by Joe + Team: =>SilverStripe\Model\Tests\List\MapTest\Team.team1 + comment2: + Name: Bob + Comment: This is a team comment by Bob + Team: =>SilverStripe\Model\Tests\List\MapTest\Team.team1 + comment3: + Name: Phil + Comment: Phil is a unique guy, and comments on team2 + Team: =>SilverStripe\Model\Tests\List\MapTest\Team.team2 diff --git a/tests/php/Model/List/MapTest/SubTeam.php b/tests/php/Model/List/MapTest/SubTeam.php new file mode 100644 index 00000000000..52006aee5e7 --- /dev/null +++ b/tests/php/Model/List/MapTest/SubTeam.php @@ -0,0 +1,14 @@ + Team::class, + ]; +} diff --git a/tests/php/Model/List/MapTest/Team.php b/tests/php/Model/List/MapTest/Team.php new file mode 100644 index 00000000000..4d604b4a756 --- /dev/null +++ b/tests/php/Model/List/MapTest/Team.php @@ -0,0 +1,39 @@ + 'Varchar', + 'DatabaseField' => 'HTMLVarchar', + 'NumericField' => 'Int', + ]; + + private static $has_many = [ + 'SubTeams' => SubTeam::class, + 'Comments' => TeamComment::class, + ]; + + private static $default_sort = '"Title"'; + + public function MyTitle() + { + return 'Team ' . $this->Title; + } +} diff --git a/tests/php/Model/List/MapTest/TeamComment.php b/tests/php/Model/List/MapTest/TeamComment.php new file mode 100644 index 00000000000..30e7456af73 --- /dev/null +++ b/tests/php/Model/List/MapTest/TeamComment.php @@ -0,0 +1,22 @@ + 'Varchar', + 'Comment' => 'Text' + ]; + + private static $has_one = [ + 'Team' => Team::class + ]; + + private static $default_sort = '"Name" ASC'; +} diff --git a/tests/php/ORM/PaginatedListTest.php b/tests/php/Model/List/PaginatedListTest.php similarity index 97% rename from tests/php/ORM/PaginatedListTest.php rename to tests/php/Model/List/PaginatedListTest.php index 81959467a47..e5436ce76ba 100644 --- a/tests/php/ORM/PaginatedListTest.php +++ b/tests/php/Model/List/PaginatedListTest.php @@ -1,30 +1,28 @@ 'Boolean', + 'ShirtNumber' => 'Varchar', + ]; + + private static $searchable_fields = [ + 'IsRetired', + 'ShirtNumber' + ]; +} diff --git a/tests/php/Model/ModelDataCustomisedTest.php b/tests/php/Model/ModelDataCustomisedTest.php new file mode 100644 index 00000000000..93f74b91eaf --- /dev/null +++ b/tests/php/Model/ModelDataCustomisedTest.php @@ -0,0 +1,55 @@ +makeOuterOriginal(), $this->makeInnerModelDataCustomised()); + $this->assertThat($outerCustomised, $this->makeTestConstraint()); + } + + public function testNestedModelDataCustomisedAsOriginal() + { + $outerCustomised = ModelDataCustomised::create($this->makeInnerModelDataCustomised(), $this->makeOuterOriginal()); + $this->assertThat($outerCustomised, $this->makeTestConstraint()); + } + + private function makeTestConstraint() + { + return new ModelDataContains([ + 'outerOriginal' => 'foobar', + 'innerOriginal' => 'hello', + 'innerCustomised' => 'world', + ]); + } + + private function makeOuterOriginal() + { + return ArrayData::create([ + 'outerOriginal' => 'foobar', + ]); + } + + private function makeInnerModelDataCustomised() + { + $original = ArrayData::create([ + 'innerOriginal' => 'hello', + ]); + + $customised = ArrayData::create([ + 'innerCustomised' => 'world', + ]); + + return ModelDataCustomised::create($original, $customised); + } +} diff --git a/tests/php/View/ViewableDataTest.php b/tests/php/Model/ModelDataTest.php similarity index 70% rename from tests/php/View/ViewableDataTest.php rename to tests/php/Model/ModelDataTest.php index 9f24042cd6b..9886131dd7b 100644 --- a/tests/php/View/ViewableDataTest.php +++ b/tests/php/Model/ModelDataTest.php @@ -1,27 +1,26 @@ testCastingHelpers()} for more tests related to casting and ViewableData behaviour, + * See {@link SSViewerTest->testCastingHelpers()} for more tests related to casting and ModelData behaviour, * from a template-parsing perspective. */ -class ViewableDataTest extends SapphireTest +class ModelDataTest extends SapphireTest { protected static $required_extensions = [ - ViewableDataTestObject::class => [ - ViewableDataTestExtension::class, + ModelDataTestObject::class => [ + ModelDataTestExtension::class, ], ]; @@ -56,10 +55,10 @@ public function testCasting() public function testRequiresCasting() { - $caster = new ViewableDataTest\Castable(); + $caster = new ModelDataTest\Castable(); - $this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); - $this->assertInstanceOf(ViewableDataTest\Caster::class, $caster->obj('noCastingInformation')); + $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); + $this->assertInstanceOf(ModelDataTest\Caster::class, $caster->obj('noCastingInformation')); $this->assertInstanceOf(DBText::class, $caster->obj('arrayOne')); $this->assertInstanceOf(ArrayList::class, $caster->obj('arrayTwo')); @@ -67,20 +66,20 @@ public function testRequiresCasting() public function testFailoverRequiresCasting() { - $caster = new ViewableDataTest\Castable(); - $container = new ViewableDataTest\Container(); + $caster = new ModelDataTest\Castable(); + $container = new ModelDataTest\Container(); $container->setFailover($caster); - $this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $container->obj('alwaysCasted')); - $this->assertInstanceOf(ViewableDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); + $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $container->obj('alwaysCasted')); + $this->assertInstanceOf(ModelDataTest\RequiresCasting::class, $caster->obj('alwaysCasted')); - $this->assertInstanceOf(ViewableDataTest\Caster::class, $container->obj('noCastingInformation')); - $this->assertInstanceOf(ViewableDataTest\Caster::class, $caster->obj('noCastingInformation')); + $this->assertInstanceOf(ModelDataTest\Caster::class, $container->obj('noCastingInformation')); + $this->assertInstanceOf(ModelDataTest\Caster::class, $caster->obj('noCastingInformation')); } public function testCastingXMLVal() { - $caster = new ViewableDataTest\Castable(); + $caster = new ModelDataTest\Castable(); $this->assertEquals('casted', $caster->XML_val('alwaysCasted')); $this->assertEquals('casted', $caster->XML_val('noCastingInformation')); @@ -92,43 +91,43 @@ public function testCastingXMLVal() public function testArrayCustomise() { - $viewableData = new ViewableDataTest\Castable(); - $newViewableData = $viewableData->customise( + $modelData = new ModelDataTest\Castable(); + $newModelData = $modelData->customise( [ 'test' => 'overwritten', 'alwaysCasted' => 'overwritten' ] ); - $this->assertEquals('test', $viewableData->XML_val('test')); - $this->assertEquals('casted', $viewableData->XML_val('alwaysCasted')); + $this->assertEquals('test', $modelData->XML_val('test')); + $this->assertEquals('casted', $modelData->XML_val('alwaysCasted')); - $this->assertEquals('overwritten', $newViewableData->XML_val('test')); - $this->assertEquals('overwritten', $newViewableData->XML_val('alwaysCasted')); + $this->assertEquals('overwritten', $newModelData->XML_val('test')); + $this->assertEquals('overwritten', $newModelData->XML_val('alwaysCasted')); - $this->assertEquals('castable', $viewableData->forTemplate()); - $this->assertEquals('castable', $newViewableData->forTemplate()); + $this->assertEquals('castable', $modelData->forTemplate()); + $this->assertEquals('castable', $newModelData->forTemplate()); } public function testObjectCustomise() { - $viewableData = new ViewableDataTest\Castable(); - $newViewableData = $viewableData->customise(new ViewableDataTest\RequiresCasting()); + $modelData = new ModelDataTest\Castable(); + $newModelData = $modelData->customise(new ModelDataTest\RequiresCasting()); - $this->assertEquals('test', $viewableData->XML_val('test')); - $this->assertEquals('casted', $viewableData->XML_val('alwaysCasted')); + $this->assertEquals('test', $modelData->XML_val('test')); + $this->assertEquals('casted', $modelData->XML_val('alwaysCasted')); - $this->assertEquals('overwritten', $newViewableData->XML_val('test')); - $this->assertEquals('casted', $newViewableData->XML_val('alwaysCasted')); + $this->assertEquals('overwritten', $newModelData->XML_val('test')); + $this->assertEquals('casted', $newModelData->XML_val('alwaysCasted')); - $this->assertEquals('castable', $viewableData->forTemplate()); - $this->assertEquals('casted', $newViewableData->forTemplate()); + $this->assertEquals('castable', $modelData->forTemplate()); + $this->assertEquals('casted', $newModelData->forTemplate()); } public function testDefaultValueWrapping() { $data = new ArrayData(['Title' => 'SomeTitleValue']); - // this results in a cached raw string in ViewableData: + // this results in a cached raw string in ModelData: $this->assertTrue($data->hasValue('Title')); $this->assertFalse($data->hasValue('SomethingElse')); // this should cast the raw string to a StringField since we are @@ -147,7 +146,7 @@ public function testCastingClass() 'Argument' => 'ArgumentType', 'ArrayArgument' => 'ArrayArgumentType' ]; - $obj = new ViewableDataTest\CastingClass(); + $obj = new ModelDataTest\CastingClass(); foreach ($expected as $field => $class) { $this->assertEquals( @@ -160,7 +159,7 @@ public function testCastingClass() public function testObjWithCachedStringValueReturnsValidObject() { - $obj = new ViewableDataTest\NoCastingInformation(); + $obj = new ModelDataTest\NoCastingInformation(); // Save a literal string into cache $cache = true; @@ -183,8 +182,8 @@ public function testObjWithCachedStringValueReturnsValidObject() public function testCaching() { - $objCached = new ViewableDataTest\Cached(); - $objNotCached = new ViewableDataTest\NotCached(); + $objCached = new ModelDataTest\Cached(); + $objNotCached = new ModelDataTest\NotCached(); $objCached->Test = 'AAA'; $objNotCached->Test = 'AAA'; @@ -202,15 +201,15 @@ public function testCaching() public function testSetFailover() { - $failover = new ViewableData(); - $container = new ViewableDataTest\Container(); + $failover = new ModelData(); + $container = new ModelDataTest\Container(); $container->setFailover($failover); $this->assertSame($failover, $container->getFailover(), 'getFailover() returned a different object'); $this->assertFalse($container->hasMethod('testMethod'), 'testMethod() is already defined when it shouldn’t be'); // Ensure that defined methods detected from the failover aren't cached when setting a new failover - $container->setFailover(new ViewableDataTest\Failover); + $container->setFailover(new ModelDataTest\Failover); $this->assertTrue($container->hasMethod('testMethod')); // Test the reverse - that defined methods previously detected in a failover are removed if they no longer exist @@ -221,10 +220,10 @@ public function testSetFailover() public function testIsAccessibleMethod() { - $reflectionMethod = new ReflectionMethod(ViewableData::class, 'isAccessibleMethod'); + $reflectionMethod = new ReflectionMethod(ModelData::class, 'isAccessibleMethod'); $reflectionMethod->setAccessible(true); - $object = new ViewableDataTestObject(); - $viewableData = new ViewableData(); + $object = new ModelDataTestObject(); + $modelData = new ModelData(); $output = $reflectionMethod->invokeArgs($object, ['privateMethod']); $this->assertFalse($output, 'Method should not be accessible'); @@ -238,7 +237,7 @@ public function testIsAccessibleMethod() $output = $reflectionMethod->invokeArgs($object, ['missingMethod']); $this->assertFalse($output, 'Method should not be accessible'); - $output = $reflectionMethod->invokeArgs($viewableData, ['isAccessibleProperty']); + $output = $reflectionMethod->invokeArgs($modelData, ['isAccessibleProperty']); $this->assertTrue($output, 'Method should be accessible'); $output = $reflectionMethod->invokeArgs($object, ['publicMethodFromExtension']); @@ -253,9 +252,9 @@ public function testIsAccessibleMethod() public function testIsAccessibleProperty() { - $reflectionMethod = new ReflectionMethod(ViewableData::class, 'isAccessibleProperty'); + $reflectionMethod = new ReflectionMethod(ModelData::class, 'isAccessibleProperty'); $reflectionMethod->setAccessible(true); - $object = new ViewableDataTestObject(); + $object = new ModelDataTestObject(); $output = $reflectionMethod->invokeArgs($object, ['privateProperty']); $this->assertFalse($output, 'Property should not be accessible'); @@ -269,19 +268,19 @@ public function testIsAccessibleProperty() $output = $reflectionMethod->invokeArgs($object, ['missingProperty']); $this->assertFalse($output, 'Property should not be accessible'); - $output = $reflectionMethod->invokeArgs(new ViewableData(), ['objCache']); + $output = $reflectionMethod->invokeArgs(new ModelData(), ['objCache']); $this->assertTrue($output, 'Property should be accessible'); } public function testDynamicData() { $obj = (object) ['SomeField' => [1, 2, 3]]; - $viewableData = new ViewableData(); - $this->assertFalse($viewableData->hasDynamicData('abc')); - $viewableData->setDynamicData('abc', $obj); - $this->assertTrue($viewableData->hasDynamicData('abc')); - $this->assertSame($obj, $viewableData->getDynamicData('abc')); - $this->assertSame($obj, $viewableData->abc); + $modelData = new ModelData(); + $this->assertFalse($modelData->hasDynamicData('abc')); + $modelData->setDynamicData('abc', $obj); + $this->assertTrue($modelData->hasDynamicData('abc')); + $this->assertSame($obj, $modelData->getDynamicData('abc')); + $this->assertSame($obj, $modelData->abc); } public function provideWrapArrayInObj(): array @@ -306,8 +305,8 @@ public function provideWrapArrayInObj(): array */ public function testWrapArrayInObj(array $arr, string $expectedClass): void { - $viewableData = new ViewableData(); - $viewableData->arr = $arr; - $this->assertInstanceOf($expectedClass, $viewableData->obj('arr')); + $modelData = new ModelData(); + $modelData->arr = $arr; + $this->assertInstanceOf($expectedClass, $modelData->obj('arr')); } } diff --git a/tests/php/Model/ModelDataTest/Cached.php b/tests/php/Model/ModelDataTest/Cached.php new file mode 100644 index 00000000000..7878fba16fb --- /dev/null +++ b/tests/php/Model/ModelDataTest/Cached.php @@ -0,0 +1,11 @@ + 'CastingType', diff --git a/tests/php/Model/ModelDataTest/Container.php b/tests/php/Model/ModelDataTest/Container.php new file mode 100644 index 00000000000..9b5b5540852 --- /dev/null +++ b/tests/php/Model/ModelDataTest/Container.php @@ -0,0 +1,11 @@ +saveIntoCalledCount++; parent::saveInto($model); diff --git a/tests/php/ORM/DataListEagerLoadingTest.php b/tests/php/ORM/DataListEagerLoadingTest.php index 13c2460c8f8..66a09bda4a8 100644 --- a/tests/php/ORM/DataListEagerLoadingTest.php +++ b/tests/php/ORM/DataListEagerLoadingTest.php @@ -12,7 +12,7 @@ use SilverStripe\ORM\DB; use SilverStripe\ORM\EagerLoadedList; use SilverStripe\ORM\ManyManyThroughList; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\EagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\EagerLoadSubClassObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\HasOneEagerLoadObject; diff --git a/tests/php/ORM/DataListTest.php b/tests/php/ORM/DataListTest.php index b5fbdf63a64..9341a18bad5 100755 --- a/tests/php/ORM/DataListTest.php +++ b/tests/php/ORM/DataListTest.php @@ -12,7 +12,7 @@ use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DB; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Tests\DataObjectTest\DataListQueryCounter; use SilverStripe\ORM\Tests\DataObjectTest\Fixture; diff --git a/tests/php/ORM/DataObjectTest.php b/tests/php/ORM/DataObjectTest.php index 5bb51505dcb..3866642a284 100644 --- a/tests/php/ORM/DataObjectTest.php +++ b/tests/php/ORM/DataObjectTest.php @@ -22,9 +22,9 @@ use SilverStripe\ORM\Tests\DataObjectTest\Player; use SilverStripe\ORM\Tests\DataObjectTest\Team; use SilverStripe\ORM\Tests\DataObjectTest\TreeNode; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\Member; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; use ReflectionMethod; use stdClass; @@ -1587,7 +1587,7 @@ public function testHasOwnTable() /* Return false if you don't pass it a subclass of DataObject */ $this->assertFalse($schema->classHasTable(DataObject::class)); - $this->assertFalse($schema->classHasTable(ViewableData::class)); + $this->assertFalse($schema->classHasTable(ModelData::class)); /* Invalid class name */ $this->assertFalse($schema->classHasTable("ThisIsntADataObject")); diff --git a/tests/php/ORM/DataObjectTest/ValidatedObject.php b/tests/php/ORM/DataObjectTest/ValidatedObject.php index 2482553cb6d..0912f8e7615 100644 --- a/tests/php/ORM/DataObjectTest/ValidatedObject.php +++ b/tests/php/ORM/DataObjectTest/ValidatedObject.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; class ValidatedObject extends DataObject implements TestOnly { diff --git a/tests/php/ORM/DataQueryTest.php b/tests/php/ORM/DataQueryTest.php index b0cfc9103ae..2ac799edf0a 100644 --- a/tests/php/ORM/DataQueryTest.php +++ b/tests/php/ORM/DataQueryTest.php @@ -6,7 +6,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Tests\DataQueryTest\ObjectE; use SilverStripe\Security\Member; diff --git a/tests/php/ORM/EagerLoadedListTest.php b/tests/php/ORM/EagerLoadedListTest.php index 901502acd2a..bbd82f5a893 100644 --- a/tests/php/ORM/EagerLoadedListTest.php +++ b/tests/php/ORM/EagerLoadedListTest.php @@ -10,7 +10,7 @@ use SilverStripe\ORM\Connect\MySQLiConnector; use SilverStripe\ORM\EagerLoadedList; use SilverStripe\ORM\DB; -use SilverStripe\ORM\Filterable; +use SilverStripe\Model\List\Filterable; use SilverStripe\ORM\Tests\DataObjectTest\EquipmentCompany; use SilverStripe\ORM\Tests\DataObjectTest\Fan; use SilverStripe\ORM\Tests\DataObjectTest\Player; diff --git a/tests/php/ORM/Filters/EndsWithFilterTest.php b/tests/php/ORM/Filters/EndsWithFilterTest.php index d8825d26c4c..98d34eef92c 100644 --- a/tests/php/ORM/Filters/EndsWithFilterTest.php +++ b/tests/php/ORM/Filters/EndsWithFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\EndsWithFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; class EndsWithFilterTest extends SapphireTest diff --git a/tests/php/ORM/Filters/ExactMatchFilterTest.php b/tests/php/ORM/Filters/ExactMatchFilterTest.php index 61cf04d42df..ab96923cbbd 100644 --- a/tests/php/ORM/Filters/ExactMatchFilterTest.php +++ b/tests/php/ORM/Filters/ExactMatchFilterTest.php @@ -8,7 +8,7 @@ use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Task; use SilverStripe\ORM\Tests\Filters\ExactMatchFilterTest\Project; use SilverStripe\ORM\DataList; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; class ExactMatchFilterTest extends SapphireTest diff --git a/tests/php/ORM/Filters/GreaterThanFilterTest.php b/tests/php/ORM/Filters/GreaterThanFilterTest.php index 6a7bcf284cc..046a7a5cf78 100644 --- a/tests/php/ORM/Filters/GreaterThanFilterTest.php +++ b/tests/php/ORM/Filters/GreaterThanFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\GreaterThanFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class GreaterThanFilterTest extends SapphireTest { diff --git a/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php b/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php index c93f3a8a9e0..ac0f5bcb964 100644 --- a/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php +++ b/tests/php/ORM/Filters/GreaterThanOrEqualFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\GreaterThanOrEqualFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class GreaterThanOrEqualFilterTest extends SapphireTest { diff --git a/tests/php/ORM/Filters/LessThanFilterTest.php b/tests/php/ORM/Filters/LessThanFilterTest.php index ac8f5fa4e1f..0737c55f811 100644 --- a/tests/php/ORM/Filters/LessThanFilterTest.php +++ b/tests/php/ORM/Filters/LessThanFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\LessThanFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class LessThanFilterTest extends SapphireTest { diff --git a/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php b/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php index 30a0f3078a1..77c5247e359 100644 --- a/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php +++ b/tests/php/ORM/Filters/LessThanOrEqualFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\LessThanOrEqualFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class LessThanOrEqualFilterTest extends SapphireTest { diff --git a/tests/php/ORM/Filters/PartialMatchFilterTest.php b/tests/php/ORM/Filters/PartialMatchFilterTest.php index f4ad899427d..ebbfd502f92 100644 --- a/tests/php/ORM/Filters/PartialMatchFilterTest.php +++ b/tests/php/ORM/Filters/PartialMatchFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\PartialMatchFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; class PartialMatchFilterTest extends SapphireTest diff --git a/tests/php/ORM/Filters/StartsWithFilterTest.php b/tests/php/ORM/Filters/StartsWithFilterTest.php index 855020f53a6..25667c868f4 100644 --- a/tests/php/ORM/Filters/StartsWithFilterTest.php +++ b/tests/php/ORM/Filters/StartsWithFilterTest.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\Filters\StartsWithFilter; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\ORM\Filters\SearchFilter; class StartsWithFilterTest extends SapphireTest diff --git a/tests/php/ORM/HierarchyTest.php b/tests/php/ORM/HierarchyTest.php index c3d2e0b1258..989cedf4bbe 100644 --- a/tests/php/ORM/HierarchyTest.php +++ b/tests/php/ORM/HierarchyTest.php @@ -2,7 +2,7 @@ namespace SilverStripe\ORM\Tests; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Versioned\Versioned; use SilverStripe\Dev\SapphireTest; diff --git a/tests/php/ORM/RelatedDataServiceTest.php b/tests/php/ORM/RelatedDataServiceTest.php index 1b6bac844c0..7ec2a968222 100644 --- a/tests/php/ORM/RelatedDataServiceTest.php +++ b/tests/php/ORM/RelatedDataServiceTest.php @@ -2,7 +2,7 @@ namespace SilverStripe\ORM\Tests; -use SilverStripe\ORM\SS_List; +use SilverStripe\Model\List\SS_List; use SilverStripe\ORM\Tests\RelatedDataServiceTest\Base; use SilverStripe\ORM\Tests\RelatedDataServiceTest\Belongs; use SilverStripe\ORM\Tests\RelatedDataServiceTest\HasMany; diff --git a/tests/php/ORM/SQLSelectTest.php b/tests/php/ORM/SQLSelectTest.php index d915a676c29..14ae868edeb 100755 --- a/tests/php/ORM/SQLSelectTest.php +++ b/tests/php/ORM/SQLSelectTest.php @@ -10,7 +10,7 @@ use SilverStripe\SQLite\SQLite3Database; use SilverStripe\PostgreSQL\PostgreSQLDatabase; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\Tests\SQLSelectTest\CteDatesObject; use SilverStripe\ORM\Tests\SQLSelectTest\CteRecursiveObject; diff --git a/tests/php/ORM/Search/BasicSearchContextTest.php b/tests/php/ORM/Search/BasicSearchContextTest.php index 58c97aacd03..64fe5ea990a 100644 --- a/tests/php/ORM/Search/BasicSearchContextTest.php +++ b/tests/php/ORM/Search/BasicSearchContextTest.php @@ -8,12 +8,12 @@ use SilverStripe\Forms\TextField; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\HiddenField; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\SearchFilter; use SilverStripe\ORM\Filters\StartsWithFilter; use SilverStripe\ORM\Search\BasicSearchContext; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class BasicSearchContextTest extends SapphireTest { diff --git a/tests/php/ORM/Search/SearchContextTest.php b/tests/php/ORM/Search/SearchContextTest.php index 839de5bc96c..918c2bf2a25 100644 --- a/tests/php/ORM/Search/SearchContextTest.php +++ b/tests/php/ORM/Search/SearchContextTest.php @@ -18,7 +18,7 @@ use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Search\SearchContext; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; class SearchContextTest extends SapphireTest { diff --git a/tests/php/Security/GroupTest.php b/tests/php/Security/GroupTest.php index b4b0af7c852..1834f019ed8 100644 --- a/tests/php/Security/GroupTest.php +++ b/tests/php/Security/GroupTest.php @@ -6,7 +6,7 @@ use SilverStripe\Control\Controller; use SilverStripe\Dev\FunctionalTest; use SilverStripe\Forms\RequiredFields; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\Security\Group; use SilverStripe\Security\Member; diff --git a/tests/php/Security/MemberAuthenticatorTest.php b/tests/php/Security/MemberAuthenticatorTest.php index 53db67188cb..53f80458716 100644 --- a/tests/php/Security/MemberAuthenticatorTest.php +++ b/tests/php/Security/MemberAuthenticatorTest.php @@ -8,7 +8,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\IdentityStore; diff --git a/tests/php/Security/MemberTest.php b/tests/php/Security/MemberTest.php index cea9ab172ef..0dfa67312c5 100644 --- a/tests/php/Security/MemberTest.php +++ b/tests/php/Security/MemberTest.php @@ -17,9 +17,9 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\Map; -use SilverStripe\ORM\ValidationException; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Model\List\Map; +use SilverStripe\Core\Validation\ValidationException; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Group; use SilverStripe\Security\IdentityStore; use SilverStripe\Security\Member; diff --git a/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php b/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php index 3fe1e2f3f21..67a8d4040d1 100644 --- a/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php +++ b/tests/php/Security/MemberTest/ExtendedChangePasswordExtension.php @@ -4,7 +4,7 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Core\Extension; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; /** * Extension that does something extra when changing a member's password diff --git a/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php b/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php index fbb4c727b66..28c66b5de87 100644 --- a/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php +++ b/tests/php/Security/MemberTest/VerySpecificPasswordValidator.php @@ -3,7 +3,7 @@ namespace SilverStripe\Security\Tests\MemberTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\PasswordValidator; class VerySpecificPasswordValidator extends PasswordValidator implements TestOnly diff --git a/tests/php/Security/PasswordExpirationMiddlewareTest.php b/tests/php/Security/PasswordExpirationMiddlewareTest.php index ce3799e0b2a..7861da34df4 100644 --- a/tests/php/Security/PasswordExpirationMiddlewareTest.php +++ b/tests/php/Security/PasswordExpirationMiddlewareTest.php @@ -5,7 +5,7 @@ use SilverStripe\Control\Director; use SilverStripe\Control\Tests\HttpRequestMockBuilder; use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\ValidationException; +use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Security\PasswordExpirationMiddleware; use SilverStripe\Security\Member; use SilverStripe\Security\Security; diff --git a/tests/php/Security/SecurityTest.php b/tests/php/Security/SecurityTest.php index bad715f7b7b..44573e00b52 100644 --- a/tests/php/Security/SecurityTest.php +++ b/tests/php/Security/SecurityTest.php @@ -18,7 +18,7 @@ use SilverStripe\ORM\FieldType\DBEnum; use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\LoginAttempt; use SilverStripe\Security\Member; use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator; diff --git a/tests/php/Security/VersionedMemberAuthenticatorTest.php b/tests/php/Security/VersionedMemberAuthenticatorTest.php index a2693156796..a53d5de3184 100644 --- a/tests/php/Security/VersionedMemberAuthenticatorTest.php +++ b/tests/php/Security/VersionedMemberAuthenticatorTest.php @@ -8,7 +8,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\SapphireTest; use SilverStripe\ORM\FieldType\DBDatetime; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\Security\Authenticator; use SilverStripe\Security\DefaultAdminService; use SilverStripe\Security\IdentityStore; diff --git a/tests/php/View/RequirementsTest.php b/tests/php/View/RequirementsTest.php index 30838d4eba9..1aba2dfc024 100644 --- a/tests/php/View/RequirementsTest.php +++ b/tests/php/View/RequirementsTest.php @@ -8,7 +8,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\i18n\i18n; use SilverStripe\View\Requirements; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use Silverstripe\Assets\Dev\TestAssetStore; use SilverStripe\View\Requirements_Backend; use SilverStripe\Core\Manifest\ResourceURLGenerator; diff --git a/tests/php/View/SSViewerCacheBlockTest.php b/tests/php/View/SSViewerCacheBlockTest.php index 09f334884df..5281b6a2578 100644 --- a/tests/php/View/SSViewerCacheBlockTest.php +++ b/tests/php/View/SSViewerCacheBlockTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\Cache\Psr16Cache; -// Not actually a data object, we just want a ViewableData object that's just for us +// Not actually a data object, we just want a ModelData object that's just for us class SSViewerCacheBlockTest extends SapphireTest { diff --git a/tests/php/View/SSViewerTest.php b/tests/php/View/SSViewerTest.php index f1eb6d76bed..ef3eaf25c80 100644 --- a/tests/php/View/SSViewerTest.php +++ b/tests/php/View/SSViewerTest.php @@ -15,14 +15,14 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\SapphireTest; use SilverStripe\i18n\i18n; -use SilverStripe\ORM\ArrayList; +use SilverStripe\Model\List\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; -use SilverStripe\ORM\PaginatedList; +use SilverStripe\Model\List\PaginatedList; use SilverStripe\Security\Permission; use SilverStripe\Security\Security; use SilverStripe\Security\SecurityToken; -use SilverStripe\View\ArrayData; +use Silverstripe\Model\ArrayData; use SilverStripe\View\Requirements; use SilverStripe\View\Requirements_Backend; use SilverStripe\View\SSTemplateParseException; @@ -31,8 +31,8 @@ use SilverStripe\View\SSViewer_FromString; use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModel; use SilverStripe\View\Tests\SSViewerTest\SSViewerTestModelController; -use SilverStripe\View\Tests\SSViewerTest\TestViewableData; -use SilverStripe\View\ViewableData; +use SilverStripe\View\Tests\SSViewerTest\TestModelData; +use SilverStripe\Model\ModelData; class SSViewerTest extends SapphireTest { @@ -598,7 +598,7 @@ public function provideArgumentTypes() */ public function testArgumentTypes(string $expected, string $template) { - $this->assertEquals($expected, $this->render($template, new TestViewableData())); + $this->assertEquals($expected, $this->render($template, new TestModelData())); } public function testObjectDotArguments() @@ -769,7 +769,7 @@ public function typePreservationDataProvider() public function testTypesArePreserved($expected, $templateArg) { $data = new ArrayData([ - 'Test' => new TestViewableData() + 'Test' => new TestModelData() ]); $this->assertEquals($expected, $this->render("\$Test.Type({$templateArg})", $data)); @@ -781,7 +781,7 @@ public function testTypesArePreserved($expected, $templateArg) public function testTypesArePreservedAsIncludeArguments($expected, $templateArg) { $data = new ArrayData([ - 'Test' => new TestViewableData() + 'Test' => new TestModelData() ]); $this->assertEquals( @@ -793,7 +793,7 @@ public function testTypesArePreservedAsIncludeArguments($expected, $templateArg) public function testTypePreservationInConditionals() { $data = new ArrayData([ - 'Test' => new TestViewableData() + 'Test' => new TestModelData() ]); // Types in conditionals @@ -1332,12 +1332,12 @@ public function assertEqualIgnoringWhitespace($a, $b, $message = '') } /** - * See {@link ViewableDataTest} for more extensive casting tests, + * See {@link ModelDataTest} for more extensive casting tests, * this test just ensures that basic casting is correctly applied during template parsing. */ public function testCastingHelpers() { - $vd = new SSViewerTest\TestViewableData(); + $vd = new SSViewerTest\TestModelData(); $vd->TextValue = 'html'; $vd->HTMLValue = 'html'; $vd->UncastedValue = 'html'; @@ -1370,8 +1370,8 @@ public function testCastingHelpers() $t = SSViewer::fromString('$HTMLValue.XML')->process($vd) ); - // Uncasted value (falls back to ViewableData::$default_cast="Text") - $vd = new SSViewerTest\TestViewableData(); + // Uncasted value (falls back to ModelData::$default_cast="Text") + $vd = new SSViewerTest\TestModelData(); $vd->UncastedValue = 'html'; $this->assertEquals( '<b>html</b>', @@ -1987,7 +1987,7 @@ public function testRewriteHashlinks() ' ); $tmpl = new SSViewer($tmplFile); - $obj = new ViewableData(); + $obj = new ModelData(); $obj->InsertedLink = DBField::create_field( 'HTMLFragment', 'InsertedLink' @@ -2042,7 +2042,7 @@ public function testRewriteHashlinksInPhpMode() ' ); $tmpl = new SSViewer($tmplFile); - $obj = new ViewableData(); + $obj = new ModelData(); $obj->InsertedLink = DBField::create_field( 'HTMLFragment', 'InsertedLink' @@ -2184,13 +2184,13 @@ public function testProcessOnlyIncludesRequirementsOnce() Requirements::set_backend($backend); - $this->assertEquals(1, substr_count($template->process(new ViewableData()) ?? '', "a.css")); - $this->assertEquals(1, substr_count($template->process(new ViewableData()) ?? '', "b.css")); + $this->assertEquals(1, substr_count($template->process(new ModelData()) ?? '', "a.css")); + $this->assertEquals(1, substr_count($template->process(new ModelData()) ?? '', "b.css")); // if we disable the requirements then we should get nothing $template->includeRequirements(false); - $this->assertEquals(0, substr_count($template->process(new ViewableData()) ?? '', "a.css")); - $this->assertEquals(0, substr_count($template->process(new ViewableData()) ?? '', "b.css")); + $this->assertEquals(0, substr_count($template->process(new ModelData()) ?? '', "a.css")); + $this->assertEquals(0, substr_count($template->process(new ModelData()) ?? '', "b.css")); } public function testRequireCallInTemplateInclude() @@ -2203,7 +2203,7 @@ public function testRequireCallInTemplateInclude() $this->assertEquals( 1, substr_count( - $template->process(new ViewableData()) ?? '', + $template->process(new ModelData()) ?? '', "tests/php/View/SSViewerTest/javascript/RequirementsTest_a.js" ) ); diff --git a/tests/php/View/SSViewerTest/CacheTestData.php b/tests/php/View/SSViewerTest/CacheTestData.php index 8f793a53cfb..6261c44f880 100644 --- a/tests/php/View/SSViewerTest/CacheTestData.php +++ b/tests/php/View/SSViewerTest/CacheTestData.php @@ -3,11 +3,11 @@ namespace SilverStripe\View\Tests\SSViewerTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use Silverstripe\Model\ArrayData; +use SilverStripe\Model\ModelData; -class CacheTestData extends ViewableData implements TestOnly +class CacheTestData extends ModelData implements TestOnly { public $testWithCalls = 0; diff --git a/tests/php/View/SSViewerTest/LevelTestData.php b/tests/php/View/SSViewerTest/LevelTestData.php index 017d47e74e8..020076812b4 100644 --- a/tests/php/View/SSViewerTest/LevelTestData.php +++ b/tests/php/View/SSViewerTest/LevelTestData.php @@ -3,10 +3,10 @@ namespace SilverStripe\View\Tests\SSViewerTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ModelData; -class LevelTestData extends ViewableData implements TestOnly +class LevelTestData extends ModelData implements TestOnly { protected $depth; diff --git a/tests/php/View/SSViewerTest/TestFixture.php b/tests/php/View/SSViewerTest/TestFixture.php index d294517138c..f0abb39bc69 100644 --- a/tests/php/View/SSViewerTest/TestFixture.php +++ b/tests/php/View/SSViewerTest/TestFixture.php @@ -2,13 +2,13 @@ namespace SilverStripe\View\Tests\SSViewerTest; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ModelData; /** * A test fixture that will echo back the template item */ -class TestFixture extends ViewableData +class TestFixture extends ModelData { protected $name; @@ -45,7 +45,7 @@ public function obj( return $output; } else { if (preg_match('/NotSet/i', $fieldName ?? '')) { - return new ViewableData(); + return new ModelData(); } else { return new TestFixture($childName); } diff --git a/tests/php/View/SSViewerTest/TestViewableData.php b/tests/php/View/SSViewerTest/TestViewableData.php index 9817666bdbd..febbbe9b460 100644 --- a/tests/php/View/SSViewerTest/TestViewableData.php +++ b/tests/php/View/SSViewerTest/TestViewableData.php @@ -3,13 +3,13 @@ namespace SilverStripe\View\Tests\SSViewerTest; use SilverStripe\Dev\TestOnly; -use SilverStripe\View\ViewableData; +use SilverStripe\Model\ModelData; /** * @property string $TextValue * @property string $HTMLValue */ -class TestViewableData extends ViewableData implements TestOnly +class TestModelData extends ModelData implements TestOnly { private static $default_cast = 'Text'; diff --git a/tests/php/View/ViewableDataCustomisedTest.php b/tests/php/View/ViewableDataCustomisedTest.php deleted file mode 100644 index df60323bac0..00000000000 --- a/tests/php/View/ViewableDataCustomisedTest.php +++ /dev/null @@ -1,55 +0,0 @@ -makeOuterOriginal(), $this->makeInnerViewableDataCustomised()); - $this->assertThat($outerCustomised, $this->makeTestConstraint()); - } - - public function testNestedViewableDataCustomisedAsOriginal() - { - $outerCustomised = ViewableData_Customised::create($this->makeInnerViewableDataCustomised(), $this->makeOuterOriginal()); - $this->assertThat($outerCustomised, $this->makeTestConstraint()); - } - - private function makeTestConstraint() - { - return new ViewableDataContains([ - 'outerOriginal' => 'foobar', - 'innerOriginal' => 'hello', - 'innerCustomised' => 'world', - ]); - } - - private function makeOuterOriginal() - { - return ArrayData::create([ - 'outerOriginal' => 'foobar', - ]); - } - - private function makeInnerViewableDataCustomised() - { - $original = ArrayData::create([ - 'innerOriginal' => 'hello', - ]); - - $customised = ArrayData::create([ - 'innerCustomised' => 'world', - ]); - - return ViewableData_Customised::create($original, $customised); - } -} diff --git a/tests/php/View/ViewableDataTest/Cached.php b/tests/php/View/ViewableDataTest/Cached.php deleted file mode 100644 index 84ccd21eccb..00000000000 --- a/tests/php/View/ViewableDataTest/Cached.php +++ /dev/null @@ -1,11 +0,0 @@ -