[coldbox-3.5.0] Getting to Grips with AOP

Hi,

Trying to do baby step with AOP and I’ve hit a problem…

function [invokemethod([any invocation])] of component [model.aspect.DatabaseAuditTrailAspect] does not match the function declarition [invokemethod(any invocation)] of the interface [coldbox.system.aop.MethodInterceptor]

output does not match interface function output definition

Here’s my Aspect…

component implements=“coldbox.system.aop.MethodInterceptor”
classMatcher=“any”
methodMatcher=“methods:save,saveAll,delete,deleteAll,deleteByQuery,deleteByID,deleteWhere” {
function init() {
return this;
}

function invokeMethod(invocation) {
return arguments.invocation.proceed();
}
}

…and this is the line from my WireBox.cfc

mapAspect(“DatabaseAuditTrailAspect”).to(“model.aspect.DatabaseAuditTrailAspect”);

I running under Rail Express 3.3.2.003

Any thought as to where I’ve gone wrong?

Richard

Add output=false to the function

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano

Close but not the whole story.

I added output=false (I thought cfscript components did need this???) but also had to make the invocation required like so…

function invokeMethod(required invocation) output=“false” {

return arguments.invocation.proceed();
}

…then my error went away (maybe a doc’s update is due?).

Thank Luis :slight_smile:

Richard

Okay, so the error message has gone away but the aspect doesn’t seem to fire however inclusive I make it. Is there any why in which I can test to see if I’ve got everything setup correctly?

Richard

Can you send me the link to update the docs please.

Sure…

http://wiki.coldbox.org/wiki/WireBox-AOP.cfm#Auto_Aspect_Binding

Maybe add a note like…

“Don’t forget to include the output=“false” even though it’s not normally required for cfscript based components and functions.”

…even though I don’t know why! :slight_smile:

Richard

Okay, I’ve knocked up a non-working sample to help others see what I might be doing wrong.

I’m guessing that the invokeMethod() should run for any calls to any methods of any components and then the dump/abort should show but it doesn’t for me.

All thoughts welcome!

Richard

WireBox.cfc (1.15 KB)

MyAspect.cfc (301 Bytes)

MyService.cfc (95 Bytes)

myHandler.cfc (186 Bytes)

myView.cfm (30 Bytes)