Request::get() in tools

Permalink
Is it a bug or is it a feature in C5 that if you do a

$request = Request::get()

in a tool, you don't have the GET nor POST parameters set in the object?

 
codingpenguins replied on at Permalink Reply
This is the same functionality of HTML. You can call $_GET or $_POST at any time because it is an array object. So based on that functionality if you call get() you should get an array with nothing as you would if you did $_GET. So to call it a bug, I would say no. It keeps the same functionality so it works just as it is suppose to.
bagonyi replied on at Permalink Reply
Thanks for you reply!

Hmm.. I thought it's just a defect for the tools, but now I see it doesn't matter where do I call Request::get() there are no request parameters in it.

So we can say that at the moment get and post parameters are only accessible via $_GET & $_POST ?
codingpenguins replied on at Permalink Reply
Oh I missed understood your question. The Request:get() is not really for GET and POST parameters. It is used to get the current request and returns from those request (IE knowing what page to open, the path of the page, getting tools, getting css, getting blocks, data, etc.) Its at \concrete5\libraries\request.php. (Static methods too)

If you talking about the function to get and post parameters it is the $this->get() which is used commonly in controllers because the parent class controller (\concrete5\libraries\controller.php) defines this method which tools is not a subclass of.

EDIT: If the second one is what are are talking about then your answer is yes to your question - only using $_POST and $_GET can be used because a tool file is not a subclass of controller.

Hopefully this helps.
bagonyi replied on at Permalink Reply
I see. Alright, then it's time for me to build this class.. :)

Thanks,

Dave