diff --git a/src/Forms/Form.php b/src/Forms/Form.php index 7c540210bc2..440ba4b5224 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -12,6 +12,7 @@ use SilverStripe\Control\Session; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Injector\Injector; +use SilverStripe\Core\Validation\ValidationInterface; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\Core\Validation\ValidationResult; @@ -21,7 +22,6 @@ use SilverStripe\View\SSViewer; use SilverStripe\Model\ModelData; use SilverStripe\Forms\Validation\Validator; -use SilverStripe\Dev\Deprecation; /** * Base class for all forms. @@ -64,7 +64,7 @@ * For example, the "URLSegment" field in a standard CMS form would be * accessible through "admin/EditForm/field/URLSegment/FieldHolder". */ -class Form extends ModelData implements HasRequestHandler +class Form extends ModelData implements HasRequestHandler, ValidationInterface { use AttributesHTML; use FormMessage; @@ -1247,18 +1247,6 @@ public function getLegend() return $this->legend; } - /** - * Alias of validate() for backwards compatibility. - * - * @return ValidationResult - * @deprecated 5.4.0 Use validate() instead - */ - public function validationResult() - { - Deprecation::notice('5.4.0', 'Use validate() instead'); - return $this->validate(); - } - /** * Processing that occurs before a form is executed. * diff --git a/tests/php/Forms/FormTest.php b/tests/php/Forms/FormTest.php index 1deb7585dbc..abf45e2605d 100644 --- a/tests/php/Forms/FormTest.php +++ b/tests/php/Forms/FormTest.php @@ -1364,7 +1364,7 @@ public function testValidateFormFields(array $values, bool $isValid) } $form = new Form(null, 'testForm', $fieldList, new FieldList([/* no actions */])); - $result = $form->validationResult(); + $result = $form->validate(); $this->assertSame($isValid, $result->isValid()); $messages = $result->getMessages(); if ($isValid) { diff --git a/tests/php/Forms/OptionsetFieldTest.php b/tests/php/Forms/OptionsetFieldTest.php index 679a6a7f882..6c0e9e71336 100644 --- a/tests/php/Forms/OptionsetFieldTest.php +++ b/tests/php/Forms/OptionsetFieldTest.php @@ -68,7 +68,7 @@ public function testValidation() $this->assertTrue($field->validate()->isValid()); // ... but should not pass "RequiredFieldsValidator" validation - $this->assertFalse($form->validationResult()->isValid()); + $this->assertFalse($form->validate()->isValid()); // disabled items shouldn't validate $field->setDisabledItems(['Five']);