OOPhoto - No More Validation In The Controller

<cffunction
	name="Validate"
	access="public"
	returntype="struct"
	output="false"
	hint="I validate the properties of the given comment and place error messages in given struct.">
 
	<!--- Define arguments. --->
	<cfargument
		name="Comment"
		type="any"
		required="true"
		hint="I am the comment that is being validated."
		/>
 
	<cfargument
		name="Errors"
		type="struct"
		required="false"
		default="#StructNew()#"
		hint="I am the struct into which erorrs will be placed."
		/>
 
 
	<!--- Check comment. --->
	<cfif NOT IsSimpleValue( ARGUMENTS.Comment.GetComment() )>
 
		<cfset ARGUMENTS.Errors.Comment = "InvalidValue" />
 
	<cfelseif NOT Len( ARGUMENTS.Comment.GetComment() )>
 
		<cfset ARGUMENTS.Errors.Comment = "Required" />
 
	<cfelseif (Len( ARGUMENTS.Comment.GetComment() ) GT 500)>
 
		<cfset ARGUMENTS.Errors.Comment = "InvalidLength" />
 
	</cfif>
 
 
	<!--- Check date created. --->
	<cfif NOT IsDate( ARGUMENTS.Comment.GetDateCreated() )>
 
		<cfset ARGUMENTS.Errors.DateCreated = "InvalidValue" />
 
	</cfif>
 
 
	<!--- Check photo. --->
	<cfif IsSimpleValue( ARGUMENTS.Comment.GetPhoto() )>
 
		<cfset ARGUMENTS.Errors.Photo = "Required" />
 
	</cfif>
 
	<!--- Return errors struct. --->
	<cfreturn ARGUMENTS.Errors />
</cffunction>

For Cut-and-Paste