Watch Tom Preston-Werner, Chris Wanstrath and Scott Chacon — Git, GitHub and Social Coding on Yahoo Developer Network.
Sorry, my blog entry is getting shorter and shorter, blame #Twitter!
Watch Tom Preston-Werner, Chris Wanstrath and Scott Chacon — Git, GitHub and Social Coding on Yahoo Developer Network.
Sorry, my blog entry is getting shorter and shorter, blame #Twitter!
If you want to use MXUnit within a CF9 ORM app, you’ll need to delete application.cfm in the mxunit folder (don’t worry, it is safe to do so) and move the mxunit folder inside your application folder. Then you may get the following exception:
Error Occurred While Processing Request
Context Validation error for tag cffunction
The end tag </cffunction> encountered on line 12 at column 11 requires a matching start tag.
If you encountered a similar error to the one above, here’s the workaround. In your own Application.cfc, set:
this.ormsettings.cfclocation = YOUR_CFC_FOLDER_PATH
Happy unit-testing. :)
Thank you Adobe for giving us IsNull() function, and we can finally use that instead of the more verbose StructKeyExists() or the less efficient IsDefined(), but how do I set a variable to null?
When do we need to set a property to null? How about a property in a persistent=true component that represents a nullable column?
Let’s say for the Member table, the gender field is optional, the gender column is nullable.
option 1: setGenderNull() method in Member.cfc:
public void function setGenderNull() {
structDelete(variables, “gender”);
}
option 2: use setGender():
m = EntityLoad(“member”, memberID);
m.setGender(JavaCast("null", ""));
Notice that this is totally valid, but this is weird because I’m not really doing anything java, but I’m forced to use JavaCast() function, why? There’s no ‘null’ value in CF!
Would you like CF to introduce NULL as a new reserved word? Then we can finally do:
m.setGender(null);
// CFML becoming more java? What do you think?