From e45151e8389f8255caee86ad47a542de1336d0a1 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 9 Nov 2022 12:13:52 +1300 Subject: [PATCH 1/4] API Stop using deprecated API --- code/BasicFieldsTestPage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BasicFieldsTestPage.php b/code/BasicFieldsTestPage.php index 9413b95..6eef58a 100644 --- a/code/BasicFieldsTestPage.php +++ b/code/BasicFieldsTestPage.php @@ -313,13 +313,13 @@ class BasicFieldsTestPage extends TestPage $disabledField->setTitle($disabledField->Title() . ' (disabled)'); $disabledField->setName($disabledField->getName() . '_disabled'); $disabledField->setValue($this->getField($field->getName())); - $tabObj->insertAfter($disabledField, $field->getName()); + $tabObj->insertAfter($field->getName(), $disabledField); $readonlyField = $field->performReadonlyTransformation(); $readonlyField->setTitle($readonlyField->Title() . ' (readonly)'); $readonlyField->setName($readonlyField->getName() . '_readonly'); $readonlyField->setValue($this->getField($field->getName())); - $tabObj->insertAfter($readonlyField, $field->getName()); + $tabObj->insertAfter($field->getName(), $readonlyField); } } From 3529484fb157c908878aafe2e61056ca90148764 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Dec 2022 01:21:22 +0000 Subject: [PATCH 2/4] Bump qs from 6.5.2 to 6.5.3 Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3. - [Release notes](https://github.com/ljharb/qs/releases) - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.5.3) --- updated-dependencies: - dependency-name: qs dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index d2b9ca2..726812f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4719,8 +4719,8 @@ q@^1.1.2: resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1" qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + version "6.5.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" query-string@^3.0.0: version "3.0.3" From f08d0eff36ab1bf462477100e00198ed68c8259b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Dec 2022 09:52:56 +0000 Subject: [PATCH 3/4] Bump minimatch from 3.0.3 to 3.0.8 Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.3 to 3.0.8. - [Release notes](https://github.com/isaacs/minimatch/releases) - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md) - [Commits](https://github.com/isaacs/minimatch/compare/v3.0.3...v3.0.8) --- updated-dependencies: - dependency-name: minimatch dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/yarn.lock b/yarn.lock index 726812f..2b8f657 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1004,7 +1004,7 @@ babylon@^6.17.4, babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" -balanced-match@^0.4.1, balanced-match@^0.4.2: +balanced-match@^0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" @@ -1040,13 +1040,6 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" -brace-expansion@^1.0.0: - version "1.1.7" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59" - dependencies: - balanced-match "^0.4.1" - concat-map "0.0.1" - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -3852,15 +3845,9 @@ minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" - dependencies: - brace-expansion "^1.0.0" - -minimatch@^3.0.4, minimatch@~3.0.2: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" +minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: + version "3.0.8" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1" dependencies: brace-expansion "^1.1.7" From 39b85c9365350195101de3668e1dea4f23d847fc Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 8 Aug 2023 13:04:08 +1200 Subject: [PATCH 4/4] MNT Make employee validatable Fix broken validation that's already there Add email field for testing field validation --- code/Employee.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/Employee.php b/code/Employee.php index 0bae537..8caa708 100644 --- a/code/Employee.php +++ b/code/Employee.php @@ -3,6 +3,7 @@ namespace SilverStripe\FrameworkTest\Model; use SilverStripe\Assets\Image; +use SilverStripe\Forms\EmailField; use SilverStripe\Forms\NumericField; use SilverStripe\Forms\TextField; use SilverStripe\ORM\Connect\MySQLSchemaManager; @@ -27,6 +28,7 @@ class Employee extends DataObject private static $db = array( 'Name' => 'Varchar', + 'Email' => 'Varchar', 'Biography' => 'HTMLText', 'DateOfBirth' => 'Date', 'Category' => 'Enum("marketing,management,rnd,hr")' @@ -90,6 +92,7 @@ class Employee extends DataObject { // Use basic scaffolder (no tabs) $fields = $this->scaffoldFormFields(); + $fields->replaceField('Email', EmailField::create('Email')); $fields->push(new NumericField('ManyMany[YearStart]', 'Year started (3.1, many-many only)')); $fields->push(new TextField('ManyMany[Role]', 'Role (3.1, many-many only)')); return $fields; @@ -142,7 +145,7 @@ class Employee extends DataObject { $result = parent::validate(); if (!$this->Name) { - $result->error('"Name" can\'t be blank'); + $result->addFieldError('Name', '"Name" can\'t be blank'); } return $result; }