Can Doctrine generated models have a prefix?

我的梦境 提交于 2019-12-11 02:59:16

问题


Is there an option in Doctrine that would specify a prefix for any classes generated by doctrine?

I'm having trouble with the new Zend autoloader and autoloading models, the doctrine autoloader doesn't help either.

Ideally I'd have the doctrine generated classes prefixed with 'Model_', as in 'Model_User'.

I ran into this issue while trying to generate migrations using generate-migrations-diff, it says Fatal error: Cannot redeclare class BaseUser in /tmp/fromprfx_doctrine_tmp_dirs/generated/BaseUser.php on line 38

Because the actual model is loaded before the newly generated class.


回答1:


Sorry, I was to hasty about asking the question and found the answer seconds later.

Adding:

Doctrine_Manager::getInstance()->setAttribute('model_loading', 'conservative');

Fixed the issue.



来源:https://stackoverflow.com/questions/934394/can-doctrine-generated-models-have-a-prefix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!