title: Symfony3 lock different parts of file
body: <p>I am doing an app where users may edit different parts of xml file. The problem is that I need to ensure that the same part of the file may be edited only by one user at a time, while the whole file (with other parts) should be unlocked for editing for other users. </p>
  
  <p>As a solution I see logging every user editing activity to DB and check whether a part of the file is being edited or not by reading the corresponding DB entry. If there is no entry - the part is free and a user is allowed to edit it, otherwise not. While this solution seems working, is there a more Symfony-like way to achieve this? Maybe with the help of event listeners or something like that? Any help would be welcome. Thank you.</p>