diff --git a/src/actions/UpdateRelationshipAction.php b/src/actions/UpdateRelationshipAction.php index 54deb24..d2b479e 100644 --- a/src/actions/UpdateRelationshipAction.php +++ b/src/actions/UpdateRelationshipAction.php @@ -9,6 +9,7 @@ use yii\db\BaseActiveRecord; use yii\web\BadRequestHttpException; use yii\web\NotFoundHttpException; +use yii\web\MethodNotAllowedHttpException; use Yii; /** @@ -34,6 +35,10 @@ public function run($id, $name) throw new NotFoundHttpException('Relationship does not exist'); } + if (!$related->multiple && Yii::$app->request->isPost) { + throw new MethodNotAllowedHttpException(); + } + if ($this->checkAccess) { call_user_func($this->checkAccess, $this->id, $model, $name); }