Yes that makes perfect sense. For some reason I was inclined to initialize 
via a __construct(), which would explain why the variables aren't getting 
processed properly.

Thanks fab!

Ian


----- Original Message ----- 
From: "Fabien POTENCIER" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, June 07, 2007 1:30 AM
Subject: [symfony-devs] Re: Accessing request params in myWebRequest


>
> Ian,
>
> Some information on how it works:
>
> - All initializations are done in the initialize() method (this is true
> for all symfony objects). This method is automatically called after
> object creation when the sfContext is created.
>
> - If you want to override the initialization process, you will have to
> override the initialize() method and first call the parent method:
>
> function initialize($context, $parameters = array(), $attributes = 
> array())
> {
>   parent::initialize($context, $parameters, $attributes);
>
>   // Your code here
>   // Parameters are now loaded
> }
>
> HTH,
> Fabien
>
> Ian wrote:
>> So I have an issue with setting/getting request parameteters in
>> myWebRequest (which is my default request factory).
>>
>> Assume I pass this url:
>>
>> http://subdomain.mydomain.com/client/list/atlanta/name/asc
>>
>> This route for this URL looks like the following:
>>
>> client_list:
>>   url:   /clients/list/:city/:order/:dir/*
>>   param: { module: client, action: list, city: denver, order: name,
>> dir: asc }
>>
>>
>> In the myWebRequest class, if I try to print $this-
>>> getParameter('city'), I get nothing.
>>
>> If I print_r($this->getParameterHolder()), I see something like this:
>>
>> sfParameterHolder Object ( [default_namespace:protected] => symfony/
>> default [parameters:protected] => Array ( [symfony/default] => Array
>> ( [module] => clients [action] => list [atlanta] => name [asc]
>> =>  ) ) )
>>
>> It basically took the URL and parsed it out literally. If you notice,
>> even the module says clients, instead of client.
>>
>> The proper request parameters ARE available in the action AND in the
>> template.  If I print_r($this->getRequest()->getParameterHolder()) in
>> the action, it displays the proper request params.
>>
>> I'm not sure exactly where I'm going wrong here, or what is being
>> manipulated in between, but I think it has something to do with the
>> way that I am initializing myWebRequest.  I have a __construct()
>> method and am calling parent::initialize(sfContext::getInstance());  I
>> also try to getParameter() inside the same construct() method, which
>> is where I first noticed that it was not populating correctly.
>>
>> Is this the correct way to do this?  I'm not sure why the parameter
>> holder isnt storing the variables properly when I access them from
>> myWebRequest, but they DO work by the time they get to the action and
>> template.
>>
>> Thanks for the help :)
>>
>>
>> >
>>
>>
>
> > 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to