setupEnvironment() Question

66 views
Skip to first unread message

fingerskier

unread,
Nov 15, 2012, 1:00:31 PM11/15/12
to framew...@googlegroups.com
Hello,

    First of all, I'm really glad to see this feature.

    I would like to automatically handle ORM settings based on environment.  However, according to the docs setupEnvironment() is "executed on every request".   So, I have to run ORMreload() to make the changes stick but a setting like dbcreate="dropcreate/update" on my dev-server makes that untenable.  Am I stuck hard-coding these settings? or, is there another way [within the framework]?


Thank You,
Matt

Sean Corfield

unread,
Nov 15, 2012, 3:11:16 PM11/15/12
to framew...@googlegroups.com
Use an application variable to figure out whether you've run your "one
off" stuff - and reset it in setupApplication() so when you reload the
framework, it will re-run it on the next request.

Make sense?

Sean

fingerskier

unread,
Nov 16, 2012, 2:34:32 PM11/16/12
to framew...@googlegroups.com
  Yes, that does make sense.  I ended up just putting a switch (getEnvironment()) { ... } statement atop my Application.cfc.  This seems to achieve what I want and allow reloading the framework per request in development.


Thank You,
Matt
Reply all
Reply to author
Forward
0 new messages