title: Symfony 2 : How to prevent multiple user editing the same form at the same time?
body: <p>On my SF application, i have "regular" form (generated with formType in controller).</p>
  
  <p>Let's say user1 edit the formA and it takes several minutes to fill it.
  In that period, user2 also edit the formA.
  You can guess, the last user that hit submit wins, and the other one looses all he filled.</p>
  
  <p>How can i prevent this from happening? This is not the case of a multiple submit (by the same user).</p>
  
  <p>I don't know if it's possible and how to best implement it, but my guess would be to add some "lock" mechanism.</p>
  
  <p>I've read <a href="https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/transactions-and-concurrency.html#locking-support" rel="nofollow noreferrer">https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/transactions-and-concurrency.html#locking-support</a> </p>
  
  <p>Would it suffice to add a @Version to a field in the entity for my Form and SF takes care of the rest ?</p>
  
  <p>I would like that when user2 tries to open the form, i can send the message : <em>"Sorry, user1 is already completing the form"</em>. I don't want that user2 looses all he fills only when he hit submit.</p>
  
  <p>Thank you.</p>