Plugin to help facilitate Post/Redirect/Get (http://en.wikipedia.org/wiki/Post/Redirect/Get)

package Default
inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin

 Methods

Perform PRG logic

__invoke(null|string $redirect = null, boolean $redirectToUrl = false) : \Zend\Http\Response | array | \Traversable | false

If a null value is present for the $redirect, the current route is retrieved and use to generate the URL for redirect.

If the request method is POST, creates a session container set to expire after 1 hop containing the values of the POST. It then redirects to the specified URL using a status 303.

If the request method is GET, checks to see if we have values in the session container, and, if so, returns them; otherwise, it returns a boolean false.

Parameters

$redirect

nullstring

$redirectToUrl

boolean

Returns

\Zend\Http\Responsearray\Traversablefalse

Get the current controller instance

getController() : null | \Zend\Stdlib\DispatchableInterface
Inherited
inherited_from \Zend\Mvc\Controller\Plugin\PluginInterface::getController()

Returns

null\Zend\Stdlib\DispatchableInterface

getSessionContainer()

getSessionContainer() : \Zend\Session\Container

Returns

\Zend\Session\Container

Set the current controller instance

setController(\Zend\Stdlib\DispatchableInterface $controller) : void
Inherited
inherited_from \Zend\Mvc\Controller\Plugin\PluginInterface::setController()

Parameters

$controller

\Zend\Stdlib\DispatchableInterface

setSessionContainer()

setSessionContainer(\Zend\Session\Container $container) : \Zend\Mvc\Controller\Plugin\PostRedirectGet

Parameters

$container

\Zend\Session\Container

Returns

\Zend\Mvc\Controller\Plugin\PostRedirectGet

TODO: Good candidate for traits method in PHP 5.4 with FilePostRedirectGet plugin

redirect(string $redirect, boolean $redirectToUrl) : \Zend\Http\Response

Parameters

$redirect

string

$redirectToUrl

boolean

Exceptions

\Zend\Mvc\Exception\RuntimeException

Returns

\Zend\Http\Response

 Properties

 

$controller

$controller : null | \Zend\Stdlib\DispatchableInterface

Default

 

$sessionContainer

$sessionContainer : \Zend\Session\Container

Default