Adds required field validation to dataobjects when used outside of the cms|controller|form context

Installs: 518

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0


dev-master 2018-01-31 06:54 UTC

This package is auto-updated.

Last update: 2024-04-13 09:53:48 UTC


This module adds a required field validation mechanism to DataObjects which can be used outside of the cms|controller|form context. It does so by adding a hook to the DataObject::validate() method to check for statically configured fields.


composer require silverstripe/required-field-validator

Configuration/Usage instructions

Required fields can be set on a DataObject subclass by adding private static $required_fields to it as below

Configuration example:

class MyObject extends DataObject
    private static $db = [
        'Title' => 'Varchar(20)'
    private static $required_fields = [


Bugs are tracked on