function setValueList($model_or_list, $field_definition = null)
{
if ($model_or_list instanceof FieldDefinition) {
// ommit first argument
$field_definition = $model_or_list;
$model_or_list = $field->refModel();
}
if ($field_definition) {
// find out if this field can be empty
$this->required = $field_definition->required();
}
if (!is_object($model_or_list)) {
return parent::setValueList($model_or_list);
} else {
// we have been passed a Model, we can do more with this
if (!$model_or_list instanceof AbstractModel) {
throw new BaseException('Only Model or Array can be specified to this function');
}
$this->dictionary = $model_or_list;
$this->allowAdd(method_exists($this->dictionary, 'addDefaultEntity'));
}
return $this;
}