title: Doctrine 2. Auto generating proxies
body: <p>I have a strange problem. I want to turn off the auto generating of my proxies in Doctrine 2. I found this line of code that should do (and does) the trick:</p>
  
  <pre><code>$config-&gt;setProxyDir(APPPATHSYSTEM."/proxies");
  $config-&gt;setProxyNamespace('Proxies');
  
  // Auto generate proxies for development
  $config-&gt;setAutoGenerateProxyClasses(DEVELOPMENT);
  </code></pre>
  
  <p>On my test environment the proxies are located at <em>application/proxies</em>. i.e.:</p>
  
  <pre><code>application/proxies/BaseUserProxy.php
  </code></pre>
  
  <p>When I'm on the live environment my code suddenly searches for the proxies at <em>application/proxies/Proxies</em> which is not the actual location.</p>
  
  <p>I do understand it has something to do with the namespace, but I don't understand why it behaves differently when using the <em>setAutoGenerateProxy</em> method.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>edit</strong></p>
  
  <p>I did generate the new proxies using the:</p>
  
  <pre><code>orm:generate-proxies
  </code></pre>
  
  <p>option. </p>
  
  <p>Which gave me this output:</p>
  
  <pre><code>php doctrine.php orm:generate-proxies
  Processing entity "Base\Element"
  Processing entity "Base\Page"
  ...
  Processing entity "Base\Site"
  
  Proxy classes generated to "/var/www/application/proxies"
  </code></pre>
  
  <p>Looking at the last line, the proxies are generated in /var/www/application/proxies. The directory listing looks like this:</p>
  
  <pre><code>BaseElementProxy.php
  BasePageProxy.php
  ...
  BaseSiteProxy.php
  </code></pre>
  
  <p>So there is no extra Proxies directory. But when I refresh my webpage it thinks there is, it gives me the following error:</p>
  
  <pre><code>Warning: require(/var/www/application//proxies/Proxies/BaseUserProxy.php) 
  [function.require]: failed to open stream: 
  No such file or directory in /var/www/library/Doctrine/Common/ClassLoader.php on line 148
  </code></pre>
  
  <p>Why is the extra Proxies directory added? If I do generate the proxies on each request it does not look in the extra Proxies directory. Anybody?</p>
  
  <p><strong>@Bryan M.</strong>: That is not a solution, but a workaround. Besides, it does not work. When generating the proxies they will, if applying your suggestion, be generated in APPPATHSYSTEM and my webapp will try to load them from APPPATHSYSTEM."Proxies". The problem is that the system looks for the proxies on different locations if I use:</p>
  
  <pre><code>$config-&gt;setAutoGenerateProxyClasses(DEVELOPMENT);
  </code></pre>
  
  <p>If DEVELOPMENT is true, it will look at APPPATHSYSTEM. If DEVELOPMENT set to false, it will look at APPPATHSYSTEM."Proxies". Just switching the DEVELOPMENT constance breaks my application, what theoretically should not be possible.</p>