How can I check if request was a POST or GET request in Symfony2 or Symfony3
If you want to do it in controller, $this->getRequest()->isMethod(‘GET’); or in your model (service), inject or pass the Request object to your model first, then do the same like the above. Edit: for Symfony 3 use this code if ($request->isMethod(‘post’)) { // your code }