title: "Access Denied Code 5" PHP Rename Error in Symfony2/Doctrine2
body: <p>I am getting the infamous Doctrine "PHP Rename Access Denied Code 5" error in my Symfony2 project when logging in using the User entity:</p>
  
  <pre><code>\\app\\cache\\dev/doctrine/orm/Proxies\\__CG__AcmeDemoBundleEntityUser.php): Access is denied. (code: 5)
  </code></pre>
  
  <p>I will log in OK, and if I am lucky, I can load a page before the session is killed as a result of the user authentication failing as a result of this error.  It only happens with this one entity.</p>
  
  <p>My colleague, with the same set up and same project has the same error but for a different entity (and ONLY that entity).</p>
  
  <p>This problem has been reported <a href="https://stackoverflow.com/questions/12894822/access-denied-error-on-rename-call-when-uploading-files-in-symfony">on here before</a>, with a link to the bug on <a href="https://github.com/doctrine/doctrine2/issues/2907" rel="nofollow noreferrer">Doctrine's GitHub</a> which was confirmed fixed as of 2.5 (confirmed in <a href="http://www.doctrine-project.org/2015/04/02/orm-2-5-0.html" rel="nofollow noreferrer">Doctrine ORM 2.5 Release Notes</a>).</p>
  
  <p>My Symfony2 project is running with Doctrine ORM 2.5.4 yet I am still getting the same error.</p>
  
  <p><strong>Attempted Fixes</strong></p>
  
  <ul>
  <li>Reinstall XAMPP;</li>
  <li>Deleted project &amp; pulled project from git;</li>
  <li>Updated vendor projects (maybe an old Doctrine ORM package remained);</li>
  <li>Closing PHPStorm (maybe it's locking the files for indexing);</li>
  <li>Disabled Windows indexing (same reason as above).</li>
  </ul>
  
  <p>Changing the value of <code>auto_generate_proxy_classes</code> from <code>%kernel.debug%</code> to <code>false</code> in config_dev.yml prevents the problem, but this <em>hides</em> the issue instead of fixing it.</p>
  
  <p>Has anyone managed to actually fix this?</p>