Skip to content

Commit

Permalink
Merge pull request #1068 from APY/feature/php8
Browse files Browse the repository at this point in the history
Feature/PHP8
  • Loading branch information
npotier authored Feb 10, 2023
2 parents 014c560 + 15ef13f commit 20655ca
Show file tree
Hide file tree
Showing 59 changed files with 953 additions and 2,179 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on: [push]

jobs:
build-test:
runs-on: ubuntu-latest
name: 'PHPUnit (PHP ${{ matrix.php }})'
strategy:
matrix:
php:
- '7.4'
- '8.0'
- '8.1'
dependencies:
- 'highest'
include:
- php: '7.4'
dependencies: 'lowest'
exclude:
- php: '7.4'
dependencies: 'highest'
steps:
- name: 'Checkout'
uses: actions/checkout@v3

- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php }}'
coverage: 'none'
extensions: 'curl, json, intl, mbstring, mongodb, openssl'

- name: 'Install Composer dependencies'
uses : 'ramsey/composer-install@v2'
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--no-interaction"

# - uses: php-actions/phpunit@v3
# with:
# version
- name: 'Run unit tests'
run: |
vendor/bin/phpunit
# ... then your own project steps ...
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function getConfigTreeBuilder()
->arrayNode('limits')
->performNoDeepMerging()
->beforeNormalization()
->ifTrue(function ($v) { return !is_array($v); })
->then(function ($v) { return [$v]; })
->ifTrue(fn($v) => !is_array($v))
->then(fn($v) => [$v])
->end()
->defaultValue([20 => '20', 50 => '50', 100 => '100'])
->prototype('scalar')->end()
Expand Down
8 changes: 8 additions & 0 deletions Grid/Action/RowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,12 @@ public function setEnabled($enabled)

return $this;
}

/**
* Get the value of callbacks
*/
public function getCallbacks()
{
return $this->callbacks;
}
}
29 changes: 29 additions & 0 deletions Grid/Column/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,11 @@ public function getData()
return $result;
}

public function getRawData()
{
return $this->data;
}

/**
* Return true if filter value is correct (has to be overridden in each Column class that can be filtered, in order to catch wrong values).
*
Expand Down Expand Up @@ -1057,4 +1062,28 @@ public static function getAvailableOperators()
{
return self::$availableOperators;
}

/**
* Get the value of params
*/
public function getParams()
{
return $this->params;
}

/**
* Get the value of callback
*/
public function getCallback()
{
return $this->callback;
}

/**
* Get the value of authorizationChecker
*/
public function getAuthorizationChecker()
{
return $this->authorizationChecker;
}
}
8 changes: 8 additions & 0 deletions Grid/Column/RankColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ public function getType()
{
return 'rank';
}

/**
* Get the value of rank
*/
public function getRank()
{
return $this->rank;
}
}
18 changes: 17 additions & 1 deletion Grid/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,27 @@ public function setColumnsOrder(array $columnIds, $keepOtherColumns = true)
}

if ($keepOtherColumns) {
$this->columns = array_merge($reorderedColumns, array_values($columnsIndexedByIds));
$this->columns = [...$reorderedColumns, ...array_values($columnsIndexedByIds)];
} else {
$this->columns = $reorderedColumns;
}

return $this;
}

/**
* Get the value of columns
*/
public function getColumns()
{
return $this->columns;
}

/**
* Get the value of extensions
*/
public function getExtensions()
{
return $this->extensions;
}
}
147 changes: 140 additions & 7 deletions Grid/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,8 @@ class Grid implements GridInterface

/**
* The grid configuration.
*
* @var GridConfigInterface
*/
private $config;
private ?\APY\DataGridBundle\Grid\GridConfigInterface $config;

/**
* Constructor.
Expand Down Expand Up @@ -351,12 +349,14 @@ public function __construct($container, $id = '', GridConfigInterface $config =
*/
public function initialize()
{
$config = $this->config;

if (!$config) {
if (!$this->config) {
return $this;
}

$config = $this->config;



$this->setPersistence($config->isPersisted());

// Route parameters
Expand Down Expand Up @@ -1315,6 +1315,11 @@ public function getTweaks()
return $this->tweaks;
}

public function getRawTweaks()
{
return $this->tweaks;
}

public function getActiveTweaks()
{
return (array) $this->get('tweaks');
Expand Down Expand Up @@ -1513,7 +1518,7 @@ public function setRouteUrl($routeUrl)
public function getRouteUrl()
{
if ($this->routeUrl === null) {
$this->routeUrl = $this->router->generate($this->request->get('_route'), $this->getRouteParameters());
$this->routeUrl = $this->router->generate((string) $this->request->get('_route'), $this->getRouteParameters());
}

return $this->routeUrl;
Expand Down Expand Up @@ -2279,4 +2284,132 @@ public function hasFilter($columnId)

return $this->getFilter($columnId) !== null;
}

/**
* Get default order (e.g. my_column_id|asc).
*
* @return string
*/
public function getDefaultOrder()
{
return $this->defaultOrder;
}

/**
* Get the value of maxResults
*
* @return int
*/
public function getMaxResults()
{
return $this->maxResults;
}

/**
* Get the value of lazyAddColumn
*/
public function getLazyAddColumn()
{
return $this->lazyAddColumn;
}

/**
* Get default Tweak.
*
* @return string
*/
public function getDefaultTweak()
{
return $this->defaultTweak;
}

/**
* Get the value of lazyVisibleColumns
*/
public function getLazyVisibleColumns()
{
return $this->lazyVisibleColumns;
}

/**
* Get the value of lazyHideShowColumns
*/
public function getLazyHideShowColumns()
{
return $this->lazyHideShowColumns;
}

/**
* Get the value of actionsColumnSize
*/
public function getActionsColumnSize()
{
return $this->actionsColumnSize;
}

/**
* Get the value of actionsColumnTitle
*/
public function getActionsColumnTitle()
{
return $this->actionsColumnTitle;
}

/**
* Get the value of showFilters
*
* @return bool
*/
public function getShowFilters()
{
return $this->showFilters;
}

/**
* Get the value of showTitles
*
* @return bool
*/
public function getShowTitles()
{
return $this->showTitles;
}

/**
* Get the value of lazyHiddenColumns
*/
public function getLazyHiddenColumns()
{
return $this->lazyHiddenColumns;
}

/**
* Get the value of newSession
*
* @return bool
*/
public function getNewSession()
{
return $this->newSession;
}

/**
* Get default filters.
*
* @return array
*/
public function getDefaultFilters()
{
return $this->defaultFilters;
}

/**
* Get permanent filters.
*
* @return array
*/
public function getPermanentFilters()
{
return $this->permanentFilters;
}
}
10 changes: 3 additions & 7 deletions Grid/GridBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,20 @@ class GridBuilder extends GridConfigBuilder implements GridBuilderInterface
{
/**
* The container.
*
* @var Container
*/
private $container;
private \Symfony\Component\DependencyInjection\Container $container;

/**
* The factory.
*
* @var GridFactoryInterface
*/
private $factory;
private \APY\DataGridBundle\Grid\GridFactoryInterface $factory;

/**
* Columns of the grid builder.
*
* @var Column[]
*/
private $columns = [];
private array $columns = [];

/**
* Constructor.
Expand Down
17 changes: 17 additions & 0 deletions Grid/GridConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ public function setPersistence($persistence)
return $this;
}


/**
* {@inheritdoc}
*/
public function getPersistence()
{
return $this->persistence;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -436,6 +445,14 @@ public function addAction(RowActionInterface $action)
return $this;
}

/**
* {@inheritdoc}
*/
public function getActions()
{
return $this->actions;
}

/**
* {@inheritdoc}
*/
Expand Down
Loading

0 comments on commit 20655ca

Please sign in to comment.