Thanks, I will tryit out!
On Mar 9, 1:01 pm, naholyr <[EMAIL PROTECTED]> wrote:
> You could overwrite getRequestParameter with something like this :
>
> function getRequestParameter($name, $default = null) {
> if (false !== ($pos = strpos($name, '/'))) {
> // We ask for an array's value
> $arrayName = substr($name, 0, $pos); // The name of the array
> variable
> $indexName = substr($name, $pos+1); // The name of the index we
> must retrieve in this array
> $array = $this->getRequestParameter($arrayName, array()); // Get
> the array with a recursive call
> return isset($array[$indexName]) ? $array[$indexName] :
> $default; // Support for default value
> } else {
> // Normal case
> return parent::getRequestParameter($name, $default);
> }
>
> }
>
> Not tested, but the idea is here : you will just call
> $this->getRequestParameter('formVars/username') and $this-
> >getRequestParameter('formVars/password') and it solves the array
>
> thing for you.
> As implemented here it should support default value (just like
> original getRequestParameter function) and any level of recursion, you
> could for example ask for getRequestParameter('myArray/mySubArray/
> myIndex', 'myDefaultValue') ;)
>
> On 5 mar, 19:18, paulo_graca <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm newbie to Symfony, and I'm currently upgrading my project from sf
> > 1.0 to 1.1.
> > There are a lot of changes in the validation, helpers, request process
> > with the inclusion of the forms.
>
> > Is there an elegante alternative to do the same thing:
>
> > //Params is an form array with username and password
> > $params = $this->getRequestParameter('formVars');
>
> > //I would like to know if is a way I can access username without
> > having to set $params variable?
> > $this->item = $temp->myFunction (
> > $params['username']
> > , $params['password']
> > );
>
> > Best regards!
> > Paulo Graça
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" 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/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---