Unit test currently failing (not on trunk yet):
http://open.silverstripe.com/changeset/63917
Each FormField->setValue() call has two parameters:
- $value: usually a string suitable for value display and saving
- $obj: The full object or array from the loadDataFrom() call
CheckboxSetField->setValue() takes its value from $obj rather than
$value, but never gets called in the first place because of the faulty
"blank" check.
A couple of solution approaches:
- Let each field handle its own definition of a blank value, and pass
the $loadBlanks preference into FormField->setValue() - seems like a
lot of adjustment and error prone in subclasses
- Let FormFields which use the second $obj parameter for setValue()
implement an interface, perhaps ComplexValueField?
- Use __call() in addition to __get() to determine if a field is
considered "blank", but don't set complex values like ComponentSets
through $value parameter
Any thoughts?
-------
Ingo Schommer | Senior Developer
SilverStripe
http://silverstripe.com
Phone: +64 4 978 7330 ext 42
Skype: chillu23