Symfony: how to filter data on an interface, as in a backend

on the symfony 1.4 / Doctrine backend, you have a tool that allows you to filter data according to date, location, age (and many others according to your model).

enter image description here

I am looking for a way to do the same (with some settings, such as deleting some fields), but in frontend . I did not find documentation on how to do this.

Do you have an idea?

+3
source share
1 answer

, , . Symfony. "":

:

class articleActions extends sfActions
{
  public function executeList(sfWebRequest $request)
  {
    $this->form = new ArticleFormFilter();
    $this->pager = new sfDoctrinePager('Article');
  }

  public function executeFilter(sfWebRequest $request)
  {
    $this->form = new ArticleFormFilter();
    $this->form->bind($request[$this->form->getName()]);
    if ($this->form->isValid())
    {
      $this->pager = new sfDoctrinePager('Article');
      $this->pager->setQuery($this->form->getQuery());
      $this->setTemplate('list');
    }
    //handle invalid form here
  }
}

, :

 foreach($pager->getResults() as $article)

Doctrine FormFilter Doctrine. FormFilter:: configure();

+5

Source: https://habr.com/ru/post/1765919/


All Articles