From 9f8cb424b74549dffbcfde4caaf7fc04c1b4d439 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:42:31 +1300 Subject: [PATCH 1/2] Bump cross-spawn from 7.0.3 to 7.0.6 (#352) Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6. - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 029abb18..1bff5912 100644 --- a/yarn.lock +++ b/yarn.lock @@ -207,6 +207,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + "@babel/helper-validator-option@^7.24.7", "@babel/helper-validator-option@^7.24.8": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d" @@ -239,6 +244,16 @@ js-tokens "^4.0.0" picocolors "^1.0.0" +"@babel/highlight@^7.8.3": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.25.9.tgz#8141ce68fc73757946f983b343f1231f4691acc6" + integrity sha512-llL88JShoCsth8fF8R4SJnIn+WLvR6ccFxu1H3FlMhDontdcmZWf2HgIZ7AIqV3Xcck1idlohrN4EUBQz6klbw== + dependencies: + "@babel/helper-validator-identifier" "^7.25.9" + chalk "^2.4.2" + js-tokens "^4.0.0" + picocolors "^1.0.0" + "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.0", "@babel/parser@^7.25.6": version "7.25.6" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.6.tgz#85660c5ef388cbbf6e3d2a694ee97a38f18afe2f" @@ -3063,9 +3078,9 @@ create-jest@^29.7.0: prompts "^2.0.1" cross-spawn@^7.0.2, cross-spawn@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" shebang-command "^2.0.0" From 1f6cf6235189fde39b163d5a8cedfabbcc8392ea Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 10 Dec 2024 16:39:26 +1300 Subject: [PATCH 2/2] API Rename validator classes --- composer.json | 2 +- docs/en/01_basic_usage.md | 8 ++++---- src/Models/EmailLink.php | 6 +++--- src/Models/ExternalLink.php | 6 +++--- src/Models/FileLink.php | 6 +++--- src/Models/PhoneLink.php | 6 +++--- src/Models/SiteTreeLink.php | 6 +++--- .../Controllers/LinkFieldControllerTest/TestPhoneLink.php | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/composer.json b/composer.json index 41d2ba36..33633221 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require-dev": { "silverstripe/frameworktest": "^2", - "dnadesign/silverstripe-elemental": "^6", + "dnadesign/silverstripe-elemental": "6.x-dev", "silverstripe/recipe-testing": "^4", "silverstripe/standards": "^1", "silverstripe/documentation-lint": "^1", diff --git a/docs/en/01_basic_usage.md b/docs/en/01_basic_usage.md index 1a37e5ed..57a66444 100644 --- a/docs/en/01_basic_usage.md +++ b/docs/en/01_basic_usage.md @@ -116,13 +116,13 @@ class MyModel extends DataObject Custom links can have validation set using standard [model validation](https://docs.silverstripe.org/en/developer_guides/forms/validation/#model-validation). This is true both for the validation of the link data itself, as well as validating relations to the `Link` class. -For example you can make sure you have a link in your `has_one` or `has_many` relation using a [`RequiredFields`](api:SilverStripe\Forms\RequiredFields) validator: +For example you can make sure you have a link in your `has_one` or `has_many` relation using a [`RequiredFieldsValidator`](api:SilverStripe\Forms\Validation\RequiredFieldsValidator) validator: ```php namespace App\Model; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; use SilverStripe\LinkField\Models\Link; use SilverStripe\ORM\DataObject; @@ -140,7 +140,7 @@ class MyModel extends DataObject public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['HasOneLink', 'HasManyLinks'])); + $validator->addValidator(RequiredFieldsValidator::create(['HasOneLink', 'HasManyLinks'])); return $validator; } } diff --git a/src/Models/EmailLink.php b/src/Models/EmailLink.php index 2a84053d..ed5d55b3 100644 --- a/src/Models/EmailLink.php +++ b/src/Models/EmailLink.php @@ -4,8 +4,8 @@ use SilverStripe\Forms\EmailField; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; /** * A link to an Email address. @@ -39,7 +39,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['Email'])); + $validator->addValidator(RequiredFieldsValidator::create(['Email'])); return $validator; } diff --git a/src/Models/ExternalLink.php b/src/Models/ExternalLink.php index 306519e2..467f448c 100644 --- a/src/Models/ExternalLink.php +++ b/src/Models/ExternalLink.php @@ -3,8 +3,8 @@ namespace SilverStripe\LinkField\Models; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; use SilverStripe\Forms\UrlField; /** @@ -41,7 +41,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['ExternalUrl'])); + $validator->addValidator(RequiredFieldsValidator::create(['ExternalUrl'])); return $validator; } diff --git a/src/Models/FileLink.php b/src/Models/FileLink.php index 22dbe175..c62698dc 100644 --- a/src/Models/FileLink.php +++ b/src/Models/FileLink.php @@ -4,8 +4,8 @@ use SilverStripe\Assets\File; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; /** * A link to a File in the CMS @@ -37,7 +37,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['File'])); + $validator->addValidator(RequiredFieldsValidator::create(['File'])); return $validator; } diff --git a/src/Models/PhoneLink.php b/src/Models/PhoneLink.php index a89e9534..a809edf7 100644 --- a/src/Models/PhoneLink.php +++ b/src/Models/PhoneLink.php @@ -3,8 +3,8 @@ namespace SilverStripe\LinkField\Models; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; /** * A link to a phone number @@ -34,7 +34,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['Phone'])); + $validator->addValidator(RequiredFieldsValidator::create(['Phone'])); return $validator; } diff --git a/src/Models/SiteTreeLink.php b/src/Models/SiteTreeLink.php index b57a6a09..f715d3f7 100644 --- a/src/Models/SiteTreeLink.php +++ b/src/Models/SiteTreeLink.php @@ -8,8 +8,8 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\TextField; use SilverStripe\Forms\TreeDropdownField; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; use SilverStripe\Forms\Tip; /** @@ -91,7 +91,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['PageID'])); + $validator->addValidator(RequiredFieldsValidator::create(['PageID'])); return $validator; } diff --git a/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php b/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php index 8328f96a..0ebd8532 100644 --- a/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php +++ b/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php @@ -4,8 +4,8 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Core\Validation\ValidationResult; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\Validator; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\Validator; use SilverStripe\LinkField\Models\Link; class TestPhoneLink extends Link implements TestOnly