Doctrine 2. Auto generating proxies

前端 未结 3 572
鱼传尺愫
鱼传尺愫 2021-02-08 10:46

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:

$con         


        
相关标签:
3条回答
  • 2021-02-08 11:15

    I don't think AutoGenerated proxies care.

    Instead of pushing autogenerated proxies to production, you should probably doctrine orm:generate-proxies, which I suspect will put them in the place your production code is configured to look for them.

    0 讨论(0)
  • 2021-02-08 11:19

    If you rename the folder to something called "/temp" you will realize the difference between path and namespace.

    The path is the absolute path to the directory the proxies are getting generated into. The namespace is necessary to allow you to configure how an autoloader picks up these entities.

    The path in your case has to be something like "proxies/Proxies" and the namespace is then "Proxies". Your autoloader has to be configured to listen to namespace prefix "Proxies" at directory "proxies/".

    This is all mood with Doctrine 2 RC1 though, we found a way to explicitly load a proxy path without help of an autoloader at no additional cost. The Proxy Namespace configuratino is therefore only necessary to make sure no other classes are in the same namespace as the proxies.

    0 讨论(0)
  • 2021-02-08 11:22

    Are you developing on OS X and deploying to Linux? OS X's filesystem is case insensitive. So I'll often run into a problem where I mistype the case of a class, and it runs and passes just fine in the local environment, but chokes on our server.

    So in this case, in OS X, the namespace "Proxies" is able to resolve to "/proxies", but in production, it can't find the class folder, and creates it under "/proxies/Proxies".

    0 讨论(0)
提交回复
热议问题