I say "cheat". Declare a controller method that listens for onRequestStart
and copies the event context into the request scope:
void function onRequestStart(required any event) {
request.event = arguments.event;
}
Assuming the ORM event handler runs in the context of the request that
triggered it, you should be able to access request.event in the ORM event
handler. I have yet to try it, so let us know how that works for you.
-- Dennis
On Tue, Nov 9, 2010 at 1:50 PM, Jim Priest <[email protected]> wrote:
> I'm using the ORM event handler to write some audit information to the
> db when I insert/update.
>
> Brian Kotek has a nice post here:
>
> http://www.briankotek.com/blog/index.cfm/2010/9/10/Using-ColdFusion-ORM-and-HQL-Part-2-ORM-Event-Handler
>
> I have no idea however how to reference data stored in my MG event in
> those handlers.
>
> I have a "currentUser" object that has a user id I'd like to pass into
> my event handler.
>
> public void function preUpdate( any entity, Struct oldData ) {
> local.timestamp = Now();
> arguments.entity.setupdateddate( local.timestamp );
> arguments.entity.setupdatedby( this should be my
> user ID );
> }
>
> Any ideas?
> Jim
>
> --
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<model-glue%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en