I think you missed the code snippets. Anyway, the PRG is easy. Depending on the type of the request, the plugin will return a different type of data. The first time you preform a GET request it will return false. In that case, just render your view by, for example, returning a ViewModel. If a POST request is performed, the plugin will save the post data in the session and return a Response object. That object contains the Location header and the 303 status code, so you just need to make your action to return it (you know that a controller action may return Response objects) That redirect will make the client to perform a new GET request, but now the plugin sees there is data in the session and it will return it as an array instead of false. In that case you need to process the data (with a form object for example) and, again, render your view.
And that's all the process. You just need to check the returned data type and do one thing or another depending on that. An example is in the indexAction of this controller https://github.com/acelaya/website/blob/master/module/Application/src/Controller/ContactController.php In the future, if you have any doubts like this, you can ask in the ZF2 Facebook group http://www.facebook.com/groups/zendframework2/ -- Alejandro Celaya Alastrué www.alejandrocelaya.com El 16/10/2014 07:32, "Wermutstropfen" <[email protected]> escribió: > Hi there, > > I have problems understanding the PRG-Plugin in the ZF2 documentation > > > > This ist my action doing form processing > > > > I don't get it. How do I combine these two? > > The rest of my code is as follows > > > > [email protected] > > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Post-redirect-get-plugin-tp4662329.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- > List: [email protected] > Info: http://framework.zend.com/archives > Unsubscribe: [email protected] > > >
