WikiaRequest is not a complete replacement for WebRequest, but it has most of the functions that we need for getting and setting request variables (from forms) as well as Cookie and Session data. Controllers have a WikiaRequest member variable called $this->request, but they also have a shorthand function for the most common use case, which is to just get a variable directly. Controller->getVal('key', 'default') will get a value from the request object.
WikiaRequest class features
- getCookie(), getCookies(), getSessionData()
- setCookie(), unsetCookie()
- getVal(), getBool(), getCheck()
- All the above functions are pretty obvious
- isXmlHttp() is for checking to see if this is an ajax request
- isDispatched() is set to true if the request has already been handled. This is really only useful for the Dispatcher to handle cases like endless redirects and error conditions, but if you find a use case for it, let us know.
- isInternal() is set when one Controller dispatches to another Controller. Some functions—most likely for security reasons—might want to restrict their usage so they cannot be called via ajax, only from another Controller. This is the main difference between Nirvana/WikiaService and Nirvana/WikiaController