Skip to content

Commit

Permalink
Merge branch 'hotfix/5.0.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pfilsx committed Sep 11, 2020
2 parents 2d9c2c3 + ebf1d7a commit a8d8c97
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Grid/Columns/ActionColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Exception;
use Pfilsx\DataGrid\DataGridException;
use Pfilsx\DataGrid\Grid\Items\DataGridItemInterface;
use Twig\Template;

class ActionColumn extends AbstractColumn
{
Expand Down Expand Up @@ -54,7 +53,8 @@ public function getCellContent($entity)
return $this->template->renderBlock('action_button', [
'url' => $this->generateUrl($entity, $matches[1]),
'action' => $matches[1],
'entity' => $entity
'entity' => $entity,
'identifier' => $this->identifier
]);
}
return '';
Expand Down
3 changes: 1 addition & 2 deletions src/Grid/DataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Pfilsx\DataGrid\DataGridServiceContainer;
use Pfilsx\DataGrid\Grid\Columns\AbstractColumn;
use Pfilsx\DataGrid\Grid\Providers\DataProviderInterface;
use Twig\Template;
use Twig\TemplateWrapper;

/**
Expand Down Expand Up @@ -213,7 +212,7 @@ protected function setTranslationDomain(?string $domain)
protected function handleRequest(): void
{
$request = $this->container->getRequest()->getCurrentRequest();
$queryParams = $request !== null ? $request->query->get('data_grid', []) : [];
$queryParams = $request !== null ? $request->query->get('data_grid') ?? [] : [];

$this->handleSorting($queryParams);

Expand Down
2 changes: 1 addition & 1 deletion src/Grid/Providers/ArrayDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@


use DateTime;
use Doctrine\Common\Persistence\ManagerRegistry;
use Pfilsx\DataGrid\DataGridException;
use Pfilsx\DataGrid\Grid\Items\ArrayGridItem;
use Pfilsx\DataGrid\Grid\Items\DataGridItem;
use Pfilsx\DataGrid\Grid\Items\EntityGridItem;
use Symfony\Bridge\Doctrine\ManagerRegistry;

class ArrayDataProvider extends DataProvider
{
Expand Down
6 changes: 3 additions & 3 deletions src/Grid/Providers/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@


use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectManager;
use Pfilsx\DataGrid\DataGridException;
use Pfilsx\DataGrid\Grid\Pager;
use Symfony\Bridge\Doctrine\ManagerRegistry;

abstract class DataProvider implements DataProviderInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Grid/Providers/RepositoryDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

use DateTime;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\EntityRepository;
use Pfilsx\DataGrid\Grid\Items\EntityGridItem;
use Symfony\Bridge\Doctrine\ManagerRegistry;

class RepositoryDataProvider extends DataProvider
{
Expand Down
8 changes: 6 additions & 2 deletions src/Resources/doc/columns/ActionColumn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Can be used to override default button rendering.
$builder->addColumn(self::ACTION_COLUMN, [
'buttons' => [
'show' => function(Object $entity, string $url){
'show' => function(Object $entity, string $url) {
return '<a href="'.$url.'?id='.$entity->id.'">Show</a>';
}
]
Expand Down Expand Up @@ -58,7 +58,11 @@ Can be used to override default url generation function.
.. code-block:: php
$builder->addActionColumn([
'urlGenerator' => function($entity, string $action, RouterInterface $router){
'urlGenerator' => function($entity, string $action, RouterInterface $router) {
return $router->generate('entity-'.$action, ['guid' => $entity->getId()]);
}
]);
identifier - string(default: null)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Can be used to override default identifier field.
2 changes: 1 addition & 1 deletion src/Resources/doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Configuration Reference
# template used for rendering grid blocks
template: 'grid/grid.blocks.html.twig'
# message used in case of no data found
noDataMessage: 'Записей не найдено'
noDataMessage: 'No records found'
# pagination configuration
pagination_enabled: true
# num of data rows on each page
Expand Down
2 changes: 1 addition & 1 deletion tests/DataGridServiceContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@



use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Bridge\Doctrine\ManagerRegistry;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
Expand Down

0 comments on commit a8d8c97

Please sign in to comment.