diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index acb33e691..85153fe4a 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -969,6 +969,11 @@ class RelationController extends ControllerBehavior elseif ($this->model->exists) { $this->relationObject->addConstraints(); } + + if ($this->relationType == 'belongsToMany') { + $this->relationObject->setQuery($query->getQuery()); + return $this->relationObject; + } }); /*