What is the most idiomatic way to paginate search results made using zend_form

I implemented the action + view, which lists all the rows in the database and allows you to paginate them using zend_paginator. I also wrote an action + view that takes a form (or get) message, builds a Solr request, and returns the zend_paginator adapter to the page based on the results.

The problem I ran into is how to break the pages into my query after postback, this is a relatively complicated search form (8 search fields).

The options that I see are as follows:

  • Move published settings to new URL and redirect
  • Email me your own paginator that saves the string parameters request
  • Serialize the results of the message form in the session and get it from there when paginated

Which one is the most zend / php way to execute it - and, more importantly, the fastest way to implement it? HELP!!!!! Thank.

+3
source share
1 answer

I will not accept this answer until I run away that someone does not have the best, but I have come to a decision. I went for the PRG template (post-redirect-get).

    if ($request->isPost()) {
        if ($form->isValid($request->getPost())) {
            return $this->_helper->redirector('index','contact',NULL,array_filter($form->getValues()));
        }
    }

This redirects the URL with the form content as parameters - www.url.com/form/param1/val/param2/val

The array_filter command removes all empty parameters, which means that you get a nice clean, bookmarked, convenient URL that zend_paginator works without.

+2
source

All Articles