From bdb3d5ff45d491514bf732a25fe614ac002d1f86 Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Thu, 25 Sep 2014 18:35:10 +1000 Subject: [PATCH] Remove hard coded key name ref --- modules/backend/formwidgets/Relation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/backend/formwidgets/Relation.php b/modules/backend/formwidgets/Relation.php index 436d45339..575275ceb 100644 --- a/modules/backend/formwidgets/Relation.php +++ b/modules/backend/formwidgets/Relation.php @@ -109,7 +109,7 @@ class Relation extends FormWidgetBase // 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 ($model->exists && (get_class($model) == get_class($relatedObj))) { - $query->where($relatedObj->getKeyName(), '<>', $model->id); + $query->where($relatedObj->getKeyName(), '<>', $model->getKey()); } // Even though "no constraints" is applied, belongsToMany constrains the query