コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function visitDatasource(DatagridConfiguration $config, DatasourceInterface $datasource)
 {
     $defaultPerPage = $config->offsetGetByPath(ToolbarExtension::PAGER_DEFAULT_PER_PAGE_OPTION_PATH, 10);
     $this->pager->setQueryBuilder($datasource->getQueryBuilder());
     $this->pager->setPage($this->getOr(self::PAGE_PARAM, 1));
     $this->pager->setMaxPerPage($this->getOr(self::PER_PAGE_PARAM, $defaultPerPage));
     $this->pager->init();
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function visitDatasource(DatagridConfiguration $config, DatasourceInterface $datasource)
 {
     $defaultPerPage = $config->offsetGetByPath(ToolbarExtension::PAGER_DEFAULT_PER_PAGE_OPTION_PATH, 10);
     if ($datasource instanceof OrmDatasource) {
         $this->pager->setQueryBuilder($datasource->getQueryBuilder());
         $this->pager->setSkipAclCheck($config->offsetGetByPath(Builder::DATASOURCE_SKIP_ACL_CHECK, false));
         $this->pager->setSkipCountWalker($config->offsetGetByPath(Builder::DATASOURCE_SKIP_COUNT_WALKER_PATH));
     }
     $this->pager->setPage($this->getOr(PagerInterface::PAGE_PARAM, 1));
     $this->pager->setMaxPerPage($this->getOr(PagerInterface::PER_PAGE_PARAM, $defaultPerPage));
     $this->pager->init();
 }
コード例 #3
0
 /**
  * {@inheritDoc}
  */
 public function visitDatasource(DatagridConfiguration $config, DatasourceInterface $datasource)
 {
     $defaultPerPage = $config->offsetGetByPath(ToolbarExtension::PAGER_DEFAULT_PER_PAGE_OPTION_PATH, 10);
     if ($datasource instanceof OrmDatasource) {
         $this->pager->setQueryBuilder($datasource->getQueryBuilder());
         $this->pager->setSkipAclCheck($config->isDatasourceSkipAclApply());
         $this->pager->setSkipCountWalker($config->offsetGetByPath(DatagridConfiguration::DATASOURCE_SKIP_COUNT_WALKER_PATH));
     }
     if ($config->offsetGetByPath(ToolbarExtension::PAGER_ONE_PAGE_OPTION_PATH, false) || $config->offsetGetByPath(ModeExtension::MODE_OPTION_PATH) === ModeExtension::MODE_CLIENT) {
         // no restrictions applied
         $this->pager->setPage(0);
         $this->pager->setMaxPerPage(0);
     } else {
         $this->pager->setPage($this->getOr(PagerInterface::PAGE_PARAM, 1));
         $this->pager->setMaxPerPage($this->getOr(PagerInterface::PER_PAGE_PARAM, $defaultPerPage));
     }
     $this->pager->init();
 }