title: insert multiple rows is slow in symfony 3
body: <p>I am doing insert multiple rows in symfony. My code inserts very slowly. Does anyone have any ideas that won't help me! Thank you !</p>
  <pre><code>                    $manager = $this-&gt;getContainer()-&gt;get('doctrine')-&gt;getEntityManager();
                      // data : object
                      foreach ($data as $value) {
                          $entitty = $stkModel-&gt;getRepository()-&gt;findOneBy(['phone' =&gt; $value-&gt;getPhone()]);
                          if ($entity) {
                              $stk = $stkModel-&gt;getEntity();
                              $stk-&gt;setName('mina');
                              $stk-&gt;setStatus(1);
                              $manager-&gt;persist($stk);
                              $manager-&gt;flush();
                          }
                          if ($stk) {
                              $entitty = $titleModel-&gt;getRepository()-&gt;findOneBy(['stkId' =&gt; $stk-&gt;getId()]);
                              $title = $titleModel-&gt;getEntity();
                              $title-&gt;setName('dev');
                              $title-&gt;setOrder(2);
                              $manager-&gt;persist($title);
                              $manager-&gt;flush();
                          }
                          // Here I take $title-&gt;getId();
                      }
  </code></pre>