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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

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

A question about DataObjectDecorators


Go to End


5 Posts   2267 Views

Avatar
Markus

Google Summer of Code Hacker, 152 Posts

17 July 2007 at 4:21am

For OpenID support I implemented a DataObjectDecorator, but I couldn't figure out how I can add a custom validator to it.

I need to ensure that the entered OpenID is unique so that only one user account is linked to a specific OpenID. Is that somehow possible?

The only way I know about is to use the augmentDatabase() method to add an unique-index to the database (adding it to extraDBFields() 'indexes' doesn't work) but in that way I can't output an error-message.

Does someone know how this can be solved?

Thanks a lot,
Markus

Avatar
Sam

Administrator, 690 Posts

17 July 2007 at 8:54pm

Arg, this is a bug. I forgot to includes indexes on the list of You'll need to fix DataObjectDecorator::loadExtraDBFields()

There's a list of the static variables that are updated; just add indexes to this list.

Avatar
Markus

Google Summer of Code Hacker, 152 Posts

18 July 2007 at 12:49am

Edited: 18/07/2007 12:58am

OK, I fixed it in r38854 (and added also defaults to it). But this doesn't help to solve my problem :-(

Now I can prevent that duplicate entries are created, but no error message will be shown since an database error occurs.. is there any way to implement a validator for DataObjectDecorators or handle such database errors ("Duplicate entry 'http://markus-lanthaler.myopenid.com/' for key 2")?

Avatar
Markus

Google Summer of Code Hacker, 152 Posts

30 July 2007 at 8:48pm

Are there any news on this? How can I implement a validator on a DataObjectDecorator??

Avatar
Markus

Google Summer of Code Hacker, 152 Posts

28 August 2007 at 1:11am

OK, I fixed that in r40925 (also for the forum module: GSoC branch r40926).

It's not the best (scalable) solution but it works for the moment and Hayden said that I should not change the core's validation behavior at the moment.