title: Postman can't access my Symfony "PUT" Route properly
body: <p>I've looked a lot of places and I can't get my PUT route to work. I just want my PUT route to edit the id of the article specified in the route, here's what my route looks like:</p>
  <pre><code>/**
   * @return Response
   * @Route(&quot;/{id}&quot;, methods={&quot;PUT&quot;})
   * @param $id
   * @param Request $request
   */
  public function edit($id, Request $request): Response
  {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $article = $em-&gt;find(Article::class,$id);
      if ($article)
      {
          $request-&gt;request-&gt;add([&quot;article&quot; =&gt; json_decode($request-&gt;getContent(), true)]);
          $form = $this-&gt;createForm(ArticleType::class, new Article())-&gt;handleRequest($request);
          if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid())
          {
              $article-&gt;setNom($form[&quot;nom&quot;]-&gt;getData());
              $article-&gt;setDescription($form[&quot;description&quot;]-&gt;getData());
              $article-&gt;setPrix($form[&quot;prix&quot;]-&gt;getData());
              $em-&gt;refresh($article);
              return $this-&gt;json($article, 205);
          }
          return $this-&gt;json([&quot;error&quot; =&gt; &quot;Bad request&quot;], 400);
      }
      return $this-&gt;json([&quot;error&quot; =&gt; &quot;Not Found&quot;], 404);
  }
  </code></pre>
  <p>It seems good to me but not for Postman although it's not completely bad as it DOES get into the code! But it returns the 400 error code so I think it means it doesn't go inside the second if and I don't get why as I used a similar setup for my DELETE route. I'm trying my best to learn how routing works but for the PUT, I'm at a loss even after hours of searching so some help would really be appreciated!</p>
  <p>If needed, here's the rest of the Controller code. And yes, I did tell my subscriber to allow &quot;PUT&quot; routes. Also, it's my first post, I hope it's good enough for this site's standards and loads of thanks to anyone willing to give me a little of their time!</p>
  <pre><code>    &lt;?php
  
  namespace App\Controller;
  
  use App\Entity\Article;
  use App\Form\ArticleType;
  use App\Repository\ArticleRepository;
  use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\Routing\Annotation\Route;
  
  /**
   * Class ArticleController
   * @package App\Controller
   * @Route(&quot;/article&quot;)
   */
  class ArticleController extends AbstractController
  {
      /**
       * @return Response
       * @Route(&quot;/&quot;, methods={&quot;GET&quot;})
       * @param ArticleRepository $repository
       */
      public function index(ArticleRepository $repository): Response
      {
          return $this-&gt;json($repository-&gt;findAll());
      }
  
      /**
       * @return Response
       * @Route(&quot;/{id}&quot;, methods={&quot;GET&quot;})
       * @param $id
       */
      public function find($id): Response
      {
          $em = $this-&gt;getdoctrine()-&gt;getmanager();
          $article = $em-&gt;find(Article::class,$id);
          if ($article)
          {
              return $this-&gt;json($article, 201);
          }
          return $this-&gt;json([&quot;error&quot; =&gt; &quot;Not Found&quot;], 404);
      }
  
      /**
       * @return Response
       * @Route(&quot;/&quot;, methods={&quot;POST&quot;})
       * @param Request $request
       */
      public function new(Request $request): Response
      {
          $request-&gt;request-&gt;add([&quot;article&quot; =&gt; json_decode($request-&gt;getContent(), true)]);
          $form = $this-&gt;createForm(ArticleType::class, new Article())-&gt;handleRequest($request);
          if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $em-&gt;persist($form-&gt;getData());
              $em-&gt;flush();
              return $this-&gt;json($form-&gt;getData(), 201);
          }
          return $this-&gt;json([&quot;error&quot; =&gt; &quot;Bad request&quot;], 400);
      }
  
      /**
       * @return Response
       * @Route(&quot;/{id}&quot;, methods={&quot;DELETE&quot;})
       * @param $id
       */
      public function delete($id): Response
      {
          $em = $this-&gt;getdoctrine()-&gt;getmanager();
          $article = $em-&gt;find(Article::class,$id);
          if ($article)
          {
              $em-&gt;remove($article);
              $em-&gt;flush();
              return $this-&gt;json($article, 205);
          }
          return $this-&gt;json([&quot;error&quot; =&gt; &quot;Not Found&quot;], 404);
      }
  </code></pre>
  <p>Also, here's my Postman Request</p>
  <pre><code>{
      &quot;nom&quot;: &quot;test&quot;,
      &quot;description&quot;: &quot;description test&quot;,
      &quot;prix&quot;: 7
  }
  </code></pre>
  <p>And here's ArticleType.php</p>
  <pre><code>&lt;?php
  
  namespace App\Form;
  
  use App\Entity\Article;
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  
  class ArticleType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('nom')
              -&gt;add('description')
              -&gt;add('prix')
          ;
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults([
              'data_class' =&gt; Article::class,
          ]);
      }
  }
  </code></pre>