I am new to CF based on the .NET background. I am wondering what kind of best practice thing will be for the next situation.
Say I have a component,, car.cfcand I have a function inside this component that requires properties:
<cfcomponent>
<cfproperty name="Name" />
<cfproperty name="Model" />
<cfproperty name="Make" />
<cffunction name="BuildCarXML">
<cfargument name="car" type="car" />
<cfsavecontent variable="xmlCar">
<?xml version="1.0" encoding="UTF-8" ?>
<car>
<name>#arguments.car.Name#</name>
</car>
</cfsavecontent>
<cfreturn xmlCar />
</cffunction>
</cfcomponent>
Finally, I call this function from the cfm page:
<cfscript>
cfcCar = CreateObject("car");
cfcCar.Name="AU";
</cfscript>
<cfdump var="#cfcCar.BuildCarXML(cfcCar)#">
My question is, is this the right / best way to do this?
source
share