title: How can I store data in Array Collection with doctrine (Symfony 4)?
body: <p>My controller:</p>
  
  <pre><code>            /**
              * @Route("/row/{slug}/{connect}/{field}/{productgroup}", name="row", methods={"POST"})
              */
  
              public function row($slug, $connect, $field,$productgroup, Request $request) {
  
                $EntityName = 'App\\Entity\\' . ucwords($slug);
                $con = 'App\\Entity\\' . ucwords($connect);
                $entity = $this-&gt;getDoctrine()-&gt;getRepository($EntityName)-&gt;findOneBy(['id' =&gt; $field]);
                $entityManager = $this-&gt;getDoctrine()-&gt;getManager();
                $argsId = $productgroup;
                $args = $entityManager-&gt;getReference($connect , $argsId);
                $entity-&gt;setProductgroup($args);
  
                $entityManager-&gt;flush();
                $response = new Response();
                $response-&gt;send();
                return $response;
  
              }
  </code></pre>
  
  <p>The error message:</p>
  
  <blockquote>
    <p>Class 'Productgroup' does not exist</p>
  </blockquote>