How do I get an event object in the preProcess() method of my plugins? - Mach-II/Mach-II-Framework GitHub Wiki

The event queue has not started to process in the preProcess() plugin point, however the event is already in the event queue. The following code will get the first event object for you to use in your preProcess() plugin point:

Example Code:

    <cffunction name="preProcess" access="public" returntype="void" output="false">
        <cfargument name="eventContext" type="MachII.framework.EventContext" required="true"/>

        <!--- Peek at the first event in the event queue --->
        <cfset var event = arguments.eventContext.getNextEvent() />

        <!--- Continue with processing... --->
    </cffunction>

Back to FAQs