dinel / metadiscourse-annotator

0 stars 0 forks source link

[Insight] A GET action should not modify an existing resource - in src/…/Controller/CorpusAdminController.php, line 290 #74

Closed dinel closed 6 years ago

dinel commented 6 years ago

in src/AppBundle/Controller/CorpusAdminController.php, line 290

The action AppBundle\Controller\CorpusAdminController::pinTextAction modifies an existing resource even though it can only be called with GET HTTP verb. Such an action should only accept PUT, POST, DELETE, or PATCH methods to avoid accidental data modification.

                $pt = new PinnedText();
                $pt->setCorpusId($corpus);
                $pt->setTextId($text);
                $pt->setUserId($user);
                $em = $this->getDoctrine()->getManager();
                $em->persist($pt);
                $em->flush();

                return new JsonResponse("Success");
            }

Posted from SensioLabsInsight