可以教导生成的模型有前缀吗? [英] Can Doctrine generated models have a prefix?

查看:182
本文介绍了可以教导生成的模型有前缀吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在新的Zend自动装载机和自动加载机型中遇到问题,在Doctrine中是否有一个可以指定由doctrine生成的任何类的前缀的选项?



理想情况下,我将使用以Model_U为前缀的以Model_为前缀的学说。



我尝试使用generate-migrations-diff生成迁移时遇到此问题,它说致命错误:无法在第38行的/tmp/fromprfx_doctrine_tmp_dirs/generated/BaseUser.php中重新声明类BaseUser



因为实际的模型是在新生成的类之前加载的。

解决方案

p>对不起,我很仓促地提出了这个问题,稍后再发现答案。



添加:

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

修正了问题。


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.

解决方案

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.

这篇关于可以教导生成的模型有前缀吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆