Now I can just grab a copy of the current production database, restore it, and run the migrations and I know I will be up to date on all of my database changes. I was able to run both up and down without issues.
Now then, it is time to get my legacy code to work with CFWheels. Much of the code from the application has been around since 2003 and relatively untouched (there was never funding to do much to it).
First, I branched the code in my repository, so I could continue to have the legacy application pre-wheels if I need it. Then in my new cfwheels branch, I added the downloaded code from the CFWheels site (version 0.9.3) to the application. Fortunately, I did not have any file naming clashes other than the index.cfm and the application.cfc files. For those, I merged my existing code from the application to those from the cfwheels files.
As I lark, I tried to run the application. FAIL. It turns out, that CFWheels wants you to put the code that would traditionally be in your application.cfc file in their separate events files (named onapplicationstart.cfm, onrequeststart.cfm, etc). So I moved my code into those files.
This caused another problem. Since my code in my old application.cfc file was in the base folder for the application, any files that it needed to include were relative to the base. Since my code was no longer in the root (it was now in the events folder), I needed a way for me to easily point the old code to the location of the old files.
So I created an application specific mapping. I do not like making mappings through the Admin interface, as it limits where I can deploy the application. Even though the folks at CFWheels would prefer you didn't make any changes to the application.cfc file, I placed the mapping there, within a cfscript block.
this.mappings["/app"] = getDirectoryFromPath(GetBaseTemplatePath());Now, whenever I need to include some legacy template in the cfwheels world, I can use the absolute path of "/app/mytemplate.cfm". Hopefully, this will greatly simplify my translation of the legacy application to cfwheels.
Next up, authentication.
No comments:
Post a Comment