Skip to content

Commit

Permalink
API Add ValidationInterface to DataObject
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 16, 2024
1 parent dc973c6 commit 56530f5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ORM/DataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Resettable;
use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\Core\Validation\ValidationInterface;
use SilverStripe\Core\Validation\ValidationResult;
use SilverStripe\Dev\Debug;
use SilverStripe\Dev\Deprecation;
Expand Down Expand Up @@ -111,7 +112,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 ModelData implements DataObjectInterface, i18nEntityProvider, Resettable
class DataObject extends ModelData implements DataObjectInterface, i18nEntityProvider, Resettable, ValidationInterface
{
/**
* Human-readable singular name.
Expand Down Expand Up @@ -1252,11 +1253,8 @@ public function forceChange()
*
* It is expected that you call validate() in your own application to test that an object is valid before
* attempting a write, and respond appropriately if it isn't.
*
* @see {@link ValidationResult}
* @return ValidationResult
*/
public function validate()
public function validate(): ValidationResult
{
$result = ValidationResult::create();
// Call DBField::validate() on every DBField
Expand Down

0 comments on commit 56530f5

Please sign in to comment.