Add morphTomany and morphedByMany support

This commit is contained in:
Peter O 2014-05-30 12:13:11 -05:00
parent 435b6d30f9
commit c29a0bb4c8
1 changed files with 5 additions and 1 deletions

View File

@ -101,7 +101,11 @@ class Relation extends FormWidgetBase
$foreignKey = $relationObj->getForeignKey();
$field->value = $this->model->$foreignKey;
}
else if ($this->relationType == ('morphToMany' || 'morphedByMany')) {
$field->type = 'checkboxlist';
$field->value = $relationObj->getRelatedIds();
}
// It is safe to assume that if the model and related model are of
// the exact same class, then it cannot be related to itself
if ($this->model->exists && (get_class($this->model) == get_class($relatedObj))) {