Fixed bug with preivous CheckboxSetField change

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62648 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-09-18 03:16:03 +00:00
parent 442af1a7ca
commit a6577d9749

View File

@ -110,9 +110,9 @@ class CheckboxSetField extends OptionsetField {
/** /**
* Load a value into this CheckboxSetField * Load a value into this CheckboxSetField
*/ */
function setValue($value, $obj) { function setValue($value, $obj = null) {
// If we're not passed a value directly, we can look for it in a relation method on the object passed as a second arg // If we're not passed a value directly, we can look for it in a relation method on the object passed as a second arg
if(!$value && $obj instanceof DataObject && $obj->hasMethod($this->name)) { if(!$value && $obj && $obj instanceof DataObject && $obj->hasMethod($this->name)) {
$funcName = $this->name; $funcName = $this->name;
$selected = $obj->$funcName(); $selected = $obj->$funcName();
$value = $selected->toDropdownMap('ID','ID'); $value = $selected->toDropdownMap('ID','ID');