This repository has been archived by the owner on Dec 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #5 Drop support for old versions (sstok)
This PR was merged into the master branch. Discussion ---------- |Q |A | |--- |---| |Bug Fix? |no | |New Feature? |yes| |BC Breaks? |yes| |Deprecations?|no | |Fixed Tickets| | Support for the latest Datagrid component, support for Symfony 2.3 is dropped, at least Symfony 2.7 is required, and Symfony 3.0 is now possible. Commits ------- ac2d95c Drop support for old versions b7ea17a Fix failing tests for DEPENDENCIES='low'
- Loading branch information
Showing
31 changed files
with
720 additions
and
481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
UPGRADE | ||
======= | ||
|
||
## Upgrade FROM 0.4 to 0.5 | ||
|
||
This version is compatible with Rollerworks Datagrid 0.8, which contains | ||
some major BC breaks! Please see the [component upgrade](https://github.com/rollerworks/datagrid/blob/v0.8.1/UPGRADE.md) | ||
instructions for more information. | ||
|
||
* Support for Symfony 2.3 is dropped, you need at least Symfony 2.7 LTS or Symfony 3 | ||
|
||
* The extension tags are renamed to follow the changes in the component. | ||
|
||
* `rollerworks_datagrid.column_type` is renamed to `rollerworks_datagrid.type` | ||
* `rollerworks_datagrid.column_extension` is renamed to `rollerworks_datagrid.type_extension`. | ||
|
||
* The `alias` argument of `rollerworks_datagrid.column_extension` is renamed to `extended_type`. | ||
|
||
* The `alias` argument of `rollerworks_datagrid.type` is no longer required, and should be removed. | ||
The FQCN is used as the type name now. | ||
|
||
* The `rollerworks_datagrid.extension` is no longer supported, you need to register your types | ||
and types extensions directly as services with the correct tags. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,11 @@ | |
|
||
namespace Rollerworks\Bundle\DatagridBundle\DependencyInjection\Compiler; | ||
|
||
use Rollerworks\Component\Datagrid\Twig\Extension\DatagridExtension as TwigDatagridExtension; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Definition; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
/** | ||
* Adds all services with the tags "rollerworks_datagrid.column_type" and "rollerworks_datagrid.column_extension" as | ||
* Adds all services with the tags "rollerworks_datagrid.type" and "rollerworks_datagrid.type_extension" as | ||
* arguments of the "rollerworks_datagrid.extension" service. | ||
* | ||
* @author Sebastiaan Stok <[email protected]> | ||
|
@@ -36,59 +33,46 @@ public function process(ContainerBuilder $container) | |
|
||
$definition = $container->getDefinition('rollerworks_datagrid.extension'); | ||
|
||
$this->processTwig($container); | ||
$this->processExtensions($container); | ||
$this->processTypes($definition, $container); | ||
$this->processTypeExtensions($definition, $container); | ||
} | ||
|
||
private function processTwig(ContainerBuilder $container) | ||
{ | ||
$reflection = new \ReflectionClass(TwigDatagridExtension::class); | ||
$extensionFolder = dirname(dirname(dirname($reflection->getFileName()))); | ||
|
||
$container->getDefinition('twig.loader.filesystem')->addMethodCall( | ||
'addPath', | ||
[$extensionFolder.'/Resources/theme'] | ||
); | ||
} | ||
|
||
private function processExtensions(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition('rollerworks_datagrid.registry')) { | ||
return; | ||
} | ||
|
||
$definition = $container->getDefinition('rollerworks_datagrid.registry'); | ||
$extensions = $definition->getArgument(0); | ||
|
||
foreach (array_keys($container->findTaggedServiceIds('rollerworks_datagrid.extension')) as $serviceId) { | ||
$extensions[] = new Reference($serviceId); | ||
} | ||
|
||
$definition->replaceArgument(0, $extensions); | ||
} | ||
|
||
private function processTypes(Definition $definition, ContainerBuilder $container) | ||
{ | ||
// Builds an array with fully-qualified type class names as keys and service IDs as values | ||
$types = []; | ||
|
||
foreach ($container->findTaggedServiceIds('rollerworks_datagrid.column_type') as $serviceId => $tag) { | ||
$alias = isset($tag[0]['alias']) ? $tag[0]['alias'] : $serviceId; | ||
// Flip, because we want tag aliases (= type identifiers) as keys | ||
$types[$alias] = $serviceId; | ||
foreach ($container->findTaggedServiceIds('rollerworks_datagrid.type') as $serviceId => $tag) { | ||
$serviceDefinition = $container->getDefinition($serviceId); | ||
if (!$serviceDefinition->isPublic()) { | ||
throw new \InvalidArgumentException( | ||
sprintf('The service "%s" must be public as datagrid types are lazy-loaded.', $serviceId) | ||
); | ||
} | ||
|
||
// Support type access by FQCN | ||
$types[$serviceDefinition->getClass()] = $serviceId; | ||
} | ||
|
||
$definition->replaceArgument(1, $types); | ||
} | ||
|
||
private function processTypeExtensions(Definition $definition, ContainerBuilder $container) | ||
{ | ||
$typeExtensions = []; | ||
|
||
foreach ($container->findTaggedServiceIds('rollerworks_datagrid.column_extension') as $serviceId => $tag) { | ||
$alias = isset($tag[0]['alias']) ? $tag[0]['alias'] : $serviceId; | ||
$typeExtensions[$alias][] = $serviceId; | ||
foreach ($container->findTaggedServiceIds('rollerworks_datagrid.type_extension') as $serviceId => $tag) { | ||
$serviceDefinition = $container->getDefinition($serviceId); | ||
if (!$serviceDefinition->isPublic()) { | ||
throw new \InvalidArgumentException( | ||
sprintf('The service "%s" must be public as datagrid type extensions are lazy-loaded.', $serviceId) | ||
); | ||
} | ||
|
||
if (isset($tag[0]['extended_type'])) { | ||
$extendedType = $tag[0]['extended_type']; | ||
} else { | ||
throw new \InvalidArgumentException( | ||
sprintf( | ||
'Tagged datagrid type extension must have the extended type configured using the '. | ||
'extended_type/extended-type attribute, none was configured for the "%s" service.', | ||
$serviceId | ||
) | ||
); | ||
} | ||
|
||
$typeExtensions[$extendedType][] = $serviceId; | ||
} | ||
|
||
$definition->replaceArgument(2, $typeExtensions); | ||
|
43 changes: 0 additions & 43 deletions
43
src/DependencyInjection/Compiler/RequestUriProviderPass.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the RollerworksDatagrid package. | ||
* | ||
* (c) Sebastiaan Stok <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Rollerworks\Bundle\DatagridBundle\DependencyInjection\Compiler; | ||
|
||
use Rollerworks\Component\Datagrid\Twig\Extension\DatagridExtension as TwigDatagridExtension; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
/** | ||
* Registers the Datagrid base themes for loading. | ||
* | ||
* @author Sebastiaan Stok <[email protected]> | ||
*/ | ||
class TwigRenderEnginePass implements CompilerPassInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
$reflection = new \ReflectionClass(TwigDatagridExtension::class); | ||
$extensionFolder = dirname(dirname(dirname($reflection->getFileName()))); | ||
|
||
$container->getDefinition('twig.loader.filesystem')->addMethodCall( | ||
'addPath', | ||
[$extensionFolder.'/Resources/theme'] | ||
); | ||
} | ||
} |
Oops, something went wrong.