问题
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