zendframework/zf2 — pull request #1884 by bjyoungblood (2012-07-13 20:08:00+00:00)
Title: Controller plugin for Post/Redirect/Get

For more information about PRG: http://en.wikipedia.org/wiki/Post/Redirect/Get

It's fairly easy to do this yourself in your controller actions, but this plugin will cut down on the amount of code you have to write by a fairly significant amount. It is aliased both to "postredirectget" and "prg" in the controller plugin manager.

Usage example:
```
// Pass in the route/url you want to redirect to after the POST
$prg = $this->prg('/user/register');

if ($prg instanceof \Zend\Http\PhpEnvironment\Response) {
// returned a response to redirect us
return $prg;
} else if ($prg === false) {
// this wasn't a POST request, but there were no params in the flash messenger
// probably this is the first time the form was loaded
return array('form' => $myForm);
}

// $prg is an array containing the POST params from the previous request
$form->setData($prg);
```