beberlei / zf-doctrine

A Zend Framework 1.x and Doctrine 1.2 Integration - UNMAINTAINED
101 stars 21 forks source link

APPLICATION_ENV ignored #16

Open taat opened 14 years ago

taat commented 14 years ago

The provider always loads the [production] section of the application.ini, not regarding the settings of APPLICATION_ENV constant.

Where do I set ZFDoctrine used [development : production] or [phpunit : production] settings? Is there any chance I could use my own BootstrapCli.php only for ZFDoctrine?

shanestillwell commented 14 years ago

Most likely this is a Zend_Tool issue. See http://framework.zend.com/issues/browse/ZF-9898

When using Zend_Tool, it hard codes the environment to 'development', not sure why you're seeing it hard coded to 'production'

admirau commented 13 years ago

Any chance for adding some workaround for this bug?

shanestillwell commented 13 years ago

@admirau, I'm not sure if ZFDoctrine can do anything, but I've edit the source code for Zend_Tool that looks to an environment variable for the value of APPLICATION_ENV. See my comment at the link for more details. http://framework.zend.com/issues/browse/ZF-9898?focusedCommentId=43896&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_43896

-Shane

admirau commented 13 years ago

@nvoyageur Thanks, I've done it similar way, but making patches to external libraries by yourself is always a bad choice. I can't wait someone fixes this in ZF or in ZFDoctrine. When the application environments are mismatched, one can easily overwrite database on production server e.g. during the migration process.

kaptenpeter commented 13 years ago

I think this has to do with the fact that Zend_Tool is really a development tool, it is assumed that you use development tools in development environment.

You could of course create your own scripts with your own classes, not very hard i think. And in that class you should of course use get_env or hardcode it. Actually it's surprising that Zend_Tool does not use get_env from the start.

But this is not a bug of ZFDoctrine.