Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Create query context on datagrid builder #3247

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ public function getFilterParameters()
/**
* {@inheritdoc}
*/
public function buildDatagrid()
public function buildDatagrid($context = 'list')
{
if ($this->datagrid) {
return;
Expand All @@ -890,7 +890,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 @@ -1461,9 +1461,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 @@ -17,6 +17,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\RouteCollection;
use Sonata\AdminBundle\Route\RouteGeneratorInterface;
Expand Down Expand Up @@ -116,9 +117,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
3 changes: 2 additions & 1 deletion Builder/DatagridBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public function addFilter(DatagridInterface $datagrid, $type, FieldDescriptionIn
/**
* @param AdminInterface $admin
* @param array $values
* @param string $context
*
* @return DatagridInterface
*/
public function getBaseDatagrid(AdminInterface $admin, array $values = array());
public function getBaseDatagrid(AdminInterface $admin, array $values = array(), $context = 'list');
}