setNextRoute() don't persist variables.

Hi Guys,

I have tried to persist variables with setNextRoute method but I can't
use it in the next route.
Is there some configuration that I must set in my instance?
e.g.:
<cffunction name="route1" access="public" returntype="void"
output="false" >
     <cfargument name="event"
type="coldbox.system.beans.requestContext" hint="RequestContext
Object" />
     <cfset var rc = event.getCollection() />

     <cfset rc.var1 = "here" />

     <cfset setNextRoute("handler/route2","var1") />
</cffunction>

<cffunction name="route1" access="public" returntype="void"
output="false" >
     <cfargument name="event"
type="coldbox.system.beans.requestContext" hint="RequestContext
Object" />
     <cfset var rc = event.getCollection() />

      <cfdump var="#rc.var1#" />
      <cfabor>

</cffuntion>

Look at the API, I don’t think you are using the method correctly.

Also, please note that in M5 release of 3.0.0 setNextEvent() will be the only method used for relocation. We got carried away during the years and have 3 at the moment: setNExtEvent(), setNextRoute() and relocate(). All three will be consolidated to setNextEvent() with named parameters.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Thanks for your fast answer.
I will try with setNextEvent().

I tried with setNextEvent() but it doesn't work yet.
I saw the API and remade it.

e.g: <cfset setNextEvent(event="handler.event1",persist="var1") />

Where is the error?
Do I have to do some configuration in my instance?

If you use the persist argument, that list of variables MUST exist in the request collection in order to get persisted.

If you want to do a la carte flashing of variables. Use the Flash object that is already configured on all handlers,layouts, views, plugins, interceptors.

You can look at the api here: http://coldbox.org/api/templates/content.cfm?file=C%3A%5CInetpub%5Cvhosts%5Ccoldboxframework%2Ecom%5Chttpdocs%5Cbuilds%5Ccoldbox%5F3%5F0%5F0B3%5Ccoldbox%5Csystem%5Cweb%5Cflash%5CAbstractFlashScope%2Ecfc

The AbstractFlashScope.cfc

Simple Example:

flash.put(name,value,saveNow,keep,inflateToRC,inflateToPRC)
flash.putAll(map, saveNow,keep,inflateToRC,inflateToPRC)

etc.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com