Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement validation with the Massive ORM?

I like Rails and so I'm drawn to Rob Conery's Massive ORM as its ... well, very railsish.

My question is how exactly can you and should you do validations with Massive? In Rails you can use the simple "validates" keyword to do inline validations and/or refer to a method to call ... along with the ability to define when such validation takes place (e.g. for create only, after save, etc...).

Are such Rails inspired validations available with Massive? If so, what's the recommended approach?

Thanks much -wg

like image 402
wgpubs Avatar asked Jul 09 '11 00:07

wgpubs


1 Answers

I was wondering about the same thing today, I still don't really have a satisfactory answer but I did find the sample code for the Tekpub MVC 3 series which has recently been pushed to Github and uses Massive for it's data access -

https://github.com/tekpub/mvc3

This class includes some DataAnnotation validations against view models, as far as I can see none of the 'domain' classes include any validation.

like image 138
ipr101 Avatar answered Sep 29 '22 12:09

ipr101