I'm trying to create my first AOP before advisor to perform auditing on dao objects. I've created an AuditBeforeAdvice cfc that is injected with an AuditService cfc.

When I call the before() method in AuditBeforeAdvice.cfc, and attempt to pass along the args to the service, they seem to zero out. When I dump the args and abort directly in AuditBeforeAdvice I can see the correct values for each arg that was passed into the method in the original object, but as soon as I pass the args off to the service object, they seem to get deleted.

Any ideas...?

Code:

AuditBeforeAdvice.cfc

<cffunction name="getAuditService" access="public" output="false" returntype="xxx.AuditService">
   <cfreturn variables.this.AuditService />
 </cffunction>

<cffunction name="setAuditService" output="false" access="public" returntype="void" > <cfargument name="AuditService" required="true" type="xxx.AuditService">
     <cfset variables.this.AuditService = arguments.AuditService >
 </cffunction>

<!--- before() is called by the aop framework before method invocation ---> <cffunction name="before" access="public" returntype="void" output="false"> <cfargument name="method" type="coldspring.aop.Method" required="true" />
   <cfargument name="args" type="struct" required="true" />
   <cfargument name="target" type="any" required="true" />

   <cfset var id = arguments.args['id'] >

<!-- <cfdump var="#id#"> note: this works, i can see correct id w/in struct --->

   <cfif arguments.method.getMethodName() IS 'delete' >
<cfset getAuditService().auditDelete(target=arguments.target,params=args,id=arguments.args['id']) />
   </cfif>

AuditService.cfc

<cffunction name="auditDelete" output="false" access="public" returntype="void">
   <cfargument name="target" type="any" required="true">
   <cfargument name="params" type="struct" required="true">
   <cfargument name="id" type="numeric" required="true">
   <cfdump var="here are args passed into auditDelete">
<cfdump var="#arguments#"><cfabort> <!--- this does not work, id is always zeroed out --->
   <cfreturn />
 </cffunction>





Reply via email to