开发者

Doctrine 2: Proxy name collisions

开发者 https://www.devze.com 2023-04-04 00:51 出处:网络
I\'m learning Doctrine 2, and noticed that the name of a generated proxy class is the original class\' full name, without the 开发者_开发技巧namespace separator, with Proxy appended to it.

I'm learning Doctrine 2, and noticed that the name of a generated proxy class is the original class' full name, without the 开发者_开发技巧namespace separator, with Proxy appended to it.

What if you use a namespaced domain model, and there is a collision?

Order         => OrderProxy
OrderProduct  => OrderProductProxy
Order\Product => OrderProductProxy (!)

Is it possible to change the naming convention for such proxies?


Looks like it's not possible at the moment.

The source code shows that this naming convention is hardcoded:

$proxyClassName = str_replace('\\', '', $className) . 'Proxy';

Anyway, I now tend to think that's it's not such a bad thing: by trying to avoid such collisions, we remove confusion in the naming of our domain classes.

0

精彩评论

暂无评论...
验证码 换一张
取 消