We do not require the request being passed to handleRequest()

refs #5525
This commit is contained in:
Johannes Meyer 2014-08-26 12:31:05 +02:00
parent 5c7999fe9b
commit 45cbd3f067

View File

@ -363,8 +363,12 @@ class Form extends Zend_Form
* *
* @return self * @return self
*/ */
public function handleRequest(Request $request) public function handleRequest(Request $request = null)
{ {
if ($request === null) {
$request = $this->getRequest();
}
if (strtolower($request->getMethod()) === $this->getMethod()) { if (strtolower($request->getMethod()) === $this->getMethod()) {
$formData = $request->{'get' . $request->isPost() ? 'Post' : 'Query'}(); $formData = $request->{'get' . $request->isPost() ? 'Post' : 'Query'}();
if ($this->wasSent($formData)) { if ($this->wasSent($formData)) {
@ -502,6 +506,16 @@ class Form extends Zend_Form
return $name; return $name;
} }
/**
* Return the current request
*
* @return Request
*/
public function getRequest()
{
return Icinga::app()->getFrontController()->getRequest();
}
/** /**
* Return the current Response * Return the current Response
* *