Skip to content

Commit

Permalink
Create query context on datagrid builder
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Sep 11, 2015
1 parent 1e0750a commit 0626811
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ public function getFilterParameters()
/**
* {@inheritdoc}
*/
public function buildDatagrid()
public function buildDatagrid($context = 'list')
{
if ($this->datagrid) {
return;
Expand All @@ -877,7 +877,7 @@ public function buildDatagrid()
}

// initialize the datagrid
$this->datagrid = $this->getDatagridBuilder()->getBaseDatagrid($this, $filterParameters);
$this->datagrid = $this->getDatagridBuilder()->getBaseDatagrid($this, $filterParameters, $context);

$this->datagrid->getPager()->setMaxPageLinks($this->maxPageLinks);

Expand Down Expand Up @@ -1447,9 +1447,9 @@ public function createQuery($context = 'list')
/**
* {@inheritdoc}
*/
public function getDatagrid()
public function getDatagrid($context = 'list')
{
$this->buildDatagrid();
$this->buildDatagrid($context);

return $this->datagrid;
}
Expand Down
7 changes: 5 additions & 2 deletions Admin/AdminInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Sonata\AdminBundle\Builder\FormContractorInterface;
use Sonata\AdminBundle\Builder\ListBuilderInterface;
use Sonata\AdminBundle\Builder\RouteBuilderInterface;
use Sonata\AdminBundle\Datagrid\DatagridInterface;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Route\RouteGeneratorInterface;
use Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface;
Expand Down Expand Up @@ -112,9 +113,11 @@ public function getClass();
public function attachAdminClass(FieldDescriptionInterface $fieldDescription);

/**
* @return \Sonata\AdminBundle\Datagrid\DatagridInterface
* @param string $context
*
* @return DatagridInterface
*/
public function getDatagrid();
public function getDatagrid($context = 'list');

/**
* Set base controller name.
Expand Down

0 comments on commit 0626811

Please sign in to comment.