Backwards Compatibility on getValue and structs

Hello!

Prior to 3.0 m5 I was able to use event.getValue to pull a struct key
using a string for example:

event.getValue("xe.something") //Where xe is a struct with a number of
values in it.

That would get me the value of the string in that struct. In 3.0 m5 it
will throw an error saying that the key doesn't exists, becuase it
only sees the struct "xe" in the collection. Is it possible to have
getValue drill down into the struct and return the value? Here is a
rewritten getValue that will return the string the way it used to.
Thanks!

  <cffunction name="getValue" returntype="Any" access="Public" hint="I
Get a value from the request collection." output="false">
    <cfargument name="name" type="any" required="true"
hint="Name of the variable to get from the request collection">
    <cfargument name="defaultValue" type="any" required="false"
default="NONE" hint="Default value to return if not found.">
    <cfargument name="private" type="boolean" required="false"
default="false" hint="Use public or private request collection"/>
    <cfscript>
      var collection = instance.context;
      var split='';
      var rtn='';
      var i='';

      if( arguments.private ){ collection = instance.privateContext; }

      if( structKeyExists(collection, arguments.name) ){
        return collection[arguments.name];
      }

      else if(find(".",arguments.name)){
        split=listToArray(arguments.name,".");
        rtn=collection;
        for(i=1; i<=arraylen(split);i++){
          if(structkeyexists(rtn,split[i])){
            rtn=rtn[split[i]];
          }
        }
        return rtn;
      }

      else if ( isSimpleValue(arguments.defaultValue) and
arguments.defaultValue eq "NONE" ){
        $throw("The variable: #arguments.name# is undefined in the request
collection.",
             "Default: #arguments.defaultValue#,
Private:#arguments.private#, Keys
#structKeyList(collection)#","RequestContext.ValueNotFound");
      }
      else{
        return arguments.defaultValue;
      }
    </cfscript>
  </cffunction>

This was changed and documented as it we wanted a higher performance on this area. However, if you still want that functionality, you can build a request context decorator and use the function you used above.

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! Will do that.

-Dave