Tweaking validators

Ouch. SilverStripe’s validators system turns out to be in need of a heavy rewrite – I hope that I won’t upset anyone by wiping out most of the RequiredFields code ;-)

Since we still need the “required field” functionality, I have to code some field-specific constraints first, so that we’re able to pass “required” as an argument to the FormField constructor (in a similiar way that Django does it).

The second step is making RequiredFields just another validator (enabled by default, but nowhere near its current state). I already have migrated some code from RequiredFields.php to its Validator.php parent and home to make the data validation experience much better for the developers. But before doing so – it’s time to write some Unit Tests.

There’s nothing better than heaps of asserts making sure that you don’t break anything while refactoring the code.


And so…. it begins

Google Summer of Code 2012 kicked off on May 22nd and it’s time to gear up! As I mentioned in a post on the main blog, I will be working on a project for SilverStripe. More specifically – on its kick-ass Sapphire framework and the form/model validation.

Forms are one of the crucial elements of every framework, and since for the last two years I’ve been exploring mostly frameworks like Django and RoR, I feel that I can bring some fresh air and exciting ideas to the topic.

During the first few days I’ve been checking out the validation rules of Symfony and other existing solutions, as well as gathering ideas from the SilverStripe’s mailing list. Now it’s time to cook up some prototype!

I will be posting on this blog every week, so make sure to check for updates on a regular basis! Also, most action will be happening on github – here is a link to my Sapphire fork.