title: Make Doctrine to add entities in original order
body: <p>I have following code:</p>
  <pre><code>$em = $this-&gt;getDoctrine()-&gt;getManager();
  
  $evaluation-&gt;getQuestions()-&gt;clear();
  
  foreach ($questions_data as $data) {
      $id = (int) $data['id'];        
  
      if ($id &gt; 0) {
          $question = $em-&gt;getRepository('MyBundle:Question')-&gt;find($id);
  
          if ($question)
              $evaluation-&gt;getQuestions()-&gt;add($question);
      }
  }
  
  $em-&gt;persist($evaluation);
  $em-&gt;flush();
  </code></pre>
  <p>Here is <code>$questions_data</code> — <code>array(['id' =&gt; 2], ['id' =&gt; 1], ['id' =&gt; 3])</code>.<br />
  And here is how doctrine persist questions to database:<br />
  <a href="https://i.stack.imgur.com/Y9zGZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y9zGZ.jpg" alt="enter image description here" /></a></p>
  <p>So, how to make doctrine to don't sort questions?<br />
  <code>Evaluation</code> entity has <code>ManyToMany</code> relation with the <code>Question</code> entity, so <code>ORDER BY</code> couldn't help, because table <code>evaluations_questions</code> was created automatically by <code>Doctrine</code> and don't have field <code>id</code>.</p>