/**
  * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  * @param array $values
  * @return \Sonata\AdminBundle\Datagrid\DatagridInterface
  */
 public function getBaseDatagrid(AdminInterface $admin, array $values = array())
 {
     $pager = new Pager();
     $pager->setCountColumn($admin->getModelManager()->getIdentifierFieldNames($admin->getClass()));
     $formBuilder = $this->formFactory->createNamedBuilder('form', 'filter', array(), array('csrf_protection' => false));
     return new Datagrid($admin->createQuery(), $admin->getList(), $pager, $formBuilder, $values);
 }
 /**
  * {@inheritdoc}
  */
 public function getBaseDatagrid(AdminInterface $admin, array $values = array())
 {
     $pager = $this->getPager($admin->getPagerType());
     $pager->setCountColumn($admin->getModelManager()->getIdentifierFieldNames($admin->getClass()));
     $defaultOptions = array();
     if ($this->csrfTokenEnabled) {
         $defaultOptions['csrf_protection'] = false;
     }
     $formBuilder = $this->formFactory->createNamedBuilder('filter', 'form', array(), $defaultOptions);
     return new Datagrid($admin->createQuery(), $admin->getList(), $pager, $formBuilder, $values);
 }
 /**
  * {@inheritdoc}
  */
 public function getBaseDatagrid(AdminInterface $admin, array $values = array())
 {
     $defaultOptions = array();
     if ($this->csrfTokenEnabled) {
         $defaultOptions['csrf_protection'] = false;
     }
     $formBuilder = $this->formFactory->createNamedBuilder('filter', 'form', array(), $defaultOptions);
     return new Datagrid($admin->createQuery(), $admin->getList(), $this->getPager(), $formBuilder, $values);
 }
    /**
     * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
     * @param array $values
     * @return \Sonata\AdminBundle\Datagrid\DatagridInterface
     */
    public function getBaseDatagrid(AdminInterface $admin, array $values = array())
    {
        $queryBuilder = $admin->getModelManager()->createQuery($admin->getClass());

        $query = new ProxyQuery($queryBuilder);
        $pager = new Pager;
        $pager->setCountColumn($admin->getModelManager()->getIdentifierFieldNames($admin->getClass()));

        return new Datagrid(
            $query,
            $admin->getList(),
            $pager,
            $this->formFactory,
            $values
        );
    }
 /**
  * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  * @param array $values
  * @return \Sonata\AdminBundle\Datagrid\DatagridInterface
  */
 public function getBaseDatagrid(AdminInterface $admin, array $values = array())
 {
     $queryBuilder = $admin->getModelManager()->getDocumentManager()->createQueryBuilder();
     $qomFactory = $queryBuilder->getQOMFactory();
     $query = new ProxyQuery($qomFactory, $queryBuilder);
     $query->setDocumentName($admin->getClass());
     $query->setDocumentManager($admin->getModelManager()->getDocumentManager());
     $pager = new Pager();
     $formBuilder = $this->formFactory->createNamedBuilder('form', 'filter', array(), array('csrf_protection' => false));
     return new Datagrid($query, $admin->getList(), $pager, $formBuilder, $values);
 }
Esempio n. 6
0
 /**
  * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  * @param array $values
  * @return \Sonata\AdminBundle\Datagrid\DatagridInterface
  */
 public function getBaseDatagrid(AdminInterface $admin, array $values = array())
 {
     $queryBuilder = $admin->getModelManager()->createQuery($admin->getClass());
     $query = new ProxyQuery($queryBuilder);
     return new Datagrid($query, $admin->getList(), new Pager(), $this->formFactory, $values);
 }