Merge pull request #233 from that0n3guy/master

Fix #229 - Add morphTomany and morphedByMany support
This commit is contained in:
Samuel Georges 2014-05-31 10:42:17 +10:00
commit 9f30a25cf1
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))) {