OOPhoto - Refactoring "With Transaction" Methods To BaseService.cfc

<cffunction
	name="OnMissingMethod"
	access="public"
	returntype="any"
	output="false"
	hint="I handle calls to methods that do not exist.">
 
	<!--- Define arguments. --->
	<cfargument
		name="MissingMethodName"
		type="string"
		required="true"
		hint="I am the name of the method that was called."
		/>
 
	<cfargument
		name="MissingMethodArguments"
		type="struct"
		required="true"
		hint="I am the arguments that were passed to the missing method."
		/>
 
	<!--- Define the local scope. --->
	<cfset var LOCAL = {} />
 
 
	<!--- Check to see if we have any special methods. --->
	<cfif REFindNoCase(
		"WithTransaction$",
		ARGUMENTS.MissingMethodName
		)>
 
		<!---
			Get the name of the method that we want
			to wrap.
		--->
		<cfset LOCAL.MethodName = REReplace(
			ARGUMENTS.MissingMethodName,
			"WithTransaction$",
			"",
			"one"
			) />
 
		<!--- Execute transaction. --->
		<cfreturn THIS.ExecuteWithTransaction(
			LOCAL.MethodName,
			ARGUMENTS.MissingMethodArguments
			) />
 
	<cfelse>
 
		<!---
			If we got this far than the method was truly
			invalid. Throw an error.
		--->
		<cfthrow
			type="OOPhoto.BaseService.InvalidMethod"
			message="The method you requested could not be found."
			detail="The method you requested, #UCase( ARGUMENTS.MissingMethodName )#, could not be accessed."
			/>
 
	</cfif>
</cffunction>

For Cut-and-Paste