php - Unable to access certain properties of the ZF2 request object -


I am currently testing ZF2 beta4, and I'm having some problems < / P>

Inside indexAction () , I have a quote for what I get for request object

Var_dump ($-> this-> request); gives me:

  object (Zend \ http \ phpEnvironment \ Request) # 119 (14) {["baseUrl": protected] = & gt; String (0) "" [...] ["version": protected] = & gt; String (3) "1.1" ["queryParams": protected] = & gt; Object (Zend \ Stadibb \ Parameters) # 122 (1) {["Storage": "Array Object": Private] = & gt; Array (3) {["q"] = & gt; String (0) "" ["param 1"] = & gt; String (6) "Value 1" ["Supreme 2"] = & gt; String (6) "value2"}} I can use some properties: 
var_dump ($ this-> request-> getBaseUrl ()); - & gt; String (0) ""
var_dump ($ this-> request-> getVersion ()); - & gt; For example, $ this-> Request-> GetQueryParams () Return:

Call the undefined method Zend \ Http \ PhpEnvironment \ Request :: getQueryParams ()

From there I have a few questions:
- Am I doing something wrong?
If not:
- How can I get a queryParams property
- Is it normal practice that something There is no way to reach the qualities (if this is what I mean to attain these qualities)?

<

Existing recipients for some properties, don class = "post-text" itemprop = "text">

All the qualities you have left are safe, so you need a waiter to get their values.

T means that they are present for everyone :)

If you take a look at the source of Zend Http \ Request (which You can see Zend Http \ PhpEnvironment \ Request )

Note : I agree that this is slightly inconsistent.

Alert : It has been changed since beta 5 and it is now getQuery ()

protected and private members Is used to ensure that the data will not be directly accessed.

It is usually used only for internal use, or is provided with public setter / gator to allow changes, error checking, etc. For example, you might want to add type hinting.

  class car {public $ engine; } $ Car = new car (); $ Car- & gt; Engine = new truck (); // Being a public member, I am not allowed to do a valid type of inquiry (I do not think `` `` `` `` `'' '' '' Engine ''); Class car {private $ engine; Public Set Engine (engine $ engine) {$ this- & gt; Engine = $ engine; // Add additional code here $ this-> Engine-> WarmUp (); }} Here I use type hinting to ensure the validity of the data, I heat the engine even after setting it.    

Comments