Code Duplication    Length = 4-4 lines in 2 locations

forms/CheckboxSetField.php 1 location

@@ 192-195 (lines=4) @@
189
	public function setValue($value, $obj = null) {
190
		// If we're not passed a value directly, we can look for it in a relation method on the object passed as a
191
		// second arg
192
		if(!$value && $obj && $obj instanceof DataObject && $obj->hasMethod($this->name)) {
193
			$funcName = $this->name;
194
			$value = $obj->$funcName()->getIDList();
195
		}
196
197
		parent::setValue($value, $obj);
198

forms/ListboxField.php 1 location

@@ 211-214 (lines=4) @@
208
	public function setValue($val, $obj = null) {
209
		// If we're not passed a value directly,
210
		// we can look for it in a relation method on the object passed as a second arg
211
		if(!$val && $obj && $obj instanceof DataObject && $obj->hasMethod($this->name)) {
212
			$funcName = $this->name;
213
			$val = array_values($obj->$funcName()->getIDList());
214
		}
215
216
		if($val) {
217
			if(!$this->multiple && is_array($val)) {