Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Setting required fields for DataObjectDecorator

Go to End

2 Posts   851 Views


Community Member, 10 Posts

27 October 2011 at 3:05am

Is it possible to define required fields using DataObjectDecorator? I am working on adding extra fields to the Member class, and from what I've read (and seen myself), extending Member is not a good idea.

Because of this, I have extended DataObjectDecorator and extended Member using my new class.

One of the fields that I've added will act as the "unique identifier field" for Member once it is extended by my class, and I need to: a) require it upon creating/editing a member, and b) ensure that the value entered is unique.

I've tried using the ForumRole class as a reference to accomplish this by creating my own Validator class and extending Member_Validator within _config.php, but it does not appear that I can define required fields using that approach.

Also something to note, I will be applying an Authenticator to this when I'm past this point to handle authentication.


Community Member, 10 Posts

1 November 2011 at 1:27am