Skip to content

Commit

Permalink
Merge pull request #425 from formapro-forks/remove-custom-route-loader
Browse files Browse the repository at this point in the history
[router] remove custom route loader.
  • Loading branch information
makasim committed May 5, 2014
2 parents 31ccd9d + 83f30f5 commit e3a28ed
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 204 deletions.
8 changes: 0 additions & 8 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ public function getConfigTreeBuilder()
->scalarNode('cache')->defaultNull()->end()
->scalarNode('data_loader')->defaultNull()->end()
->scalarNode('controller_action')->defaultNull()->end()
->arrayNode('route')
->defaultValue(array())
->useAttributeAsKey('name')
->prototype('array')
->useAttributeAsKey('name')
->prototype('variable')->end()
->end()
->end()
->arrayNode('filters')
->useAttributeAsKey('name')
->prototype('array')
Expand Down
1 change: 0 additions & 1 deletion DependencyInjection/LiipImagineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public function load(array $configs, ContainerBuilder $container)

$container->setAlias('liip_imagine', new Alias('liip_imagine.'.$config['driver']));

$container->setParameter('liip_imagine.cache_prefix', 'media/cache');
$container->setParameter('liip_imagine.cache.resolver.default', $config['cache']);

$container->setParameter('liip_imagine.filter_sets', $config['filter_sets']);
Expand Down
3 changes: 2 additions & 1 deletion Imagine/Cache/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ public function generateUrl($path, $filter, array $runtimeConfig = array())
{
$params = array(
'path' => ltrim($path, '/'),
'filter' => $filter
);

if (!empty($runtimeConfig)) {
$params['filters'] = $runtimeConfig;
}

$filterUrl = $this->router->generate('_imagine_'.$filter, $params, true);
$filterUrl = $this->router->generate('liip_imagine_filter', $params, true);

if (!empty($runtimeConfig)) {
$filterUrl = $this->uriSigner->sign($filterUrl);
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ After installing the bundle, make sure you add this route to your routing:
``` yaml
# app/config/routing.yml

_imagine:
resource: .
type: imagine
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.xml"
```
For a complete configuration drill-down see [the respective chapter in the documentation](Resources/doc/configuration.md).
Expand Down
13 changes: 0 additions & 13 deletions Resources/config/imagine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

<parameter key="liip_imagine.controller.class">Liip\ImagineBundle\Controller\ImagineController</parameter>

<!-- Route loader class -->

<parameter key="liip_imagine.routing.loader.class">Liip\ImagineBundle\Routing\ImagineLoader</parameter>

<!-- Templating classes -->

<parameter key="liip_imagine.twig.extension.class">Liip\ImagineBundle\Templating\ImagineExtension</parameter>
Expand Down Expand Up @@ -101,15 +97,6 @@
<argument type="service" id="liip_imagine.uri_signer" />
</service>

<!-- Route Loader -->

<service id="liip_imagine.routing.loader" class="%liip_imagine.routing.loader.class%">
<tag name="routing.loader" />
<argument type="service" id="liip_imagine.filter.configuration" />
<argument>%liip_imagine.controller_action%</argument>
<argument>%liip_imagine.cache_prefix%</argument>
</service>

<!-- ImagineInterface instances -->

<service id="liip_imagine" alias="liip_imagine.gd" />
Expand Down
13 changes: 13 additions & 0 deletions Resources/config/routing.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>

<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="liip_imagine_filter" path="/media/cache/{filter}/{path}" methods="GET">
<default key="_controller">%liip_imagine.controller_action%</default>
<requirement key="filter">[A-z0-9_\-]*</requirement>
<requirement key="path">.+</requirement>
</route>
</routes>
5 changes: 2 additions & 3 deletions Resources/doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ Finally, add the following to your routing file:
``` yaml
# app/config/routing.yml

_imagine:
resource: .
type: imagine
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.xml"
```
Congratulations! You're ready to rock your images!
Expand Down
97 changes: 0 additions & 97 deletions Routing/ImagineLoader.php

This file was deleted.

2 changes: 1 addition & 1 deletion Tests/Functional/Command/RemoveCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function setUp()
$this->client = $this->createClient();

$this->webRoot = self::$kernel->getContainer()->getParameter('kernel.root_dir').'/web';
$this->cacheRoot = $this->webRoot.'/'.self::$kernel->getContainer()->getParameter('liip_imagine.cache_prefix');
$this->cacheRoot = $this->webRoot.'/media/cache';

$this->filesystem = new Filesystem;
$this->filesystem->remove($this->cacheRoot);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/Command/ResolveCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function setUp()
$this->client = $this->createClient();

$this->webRoot = self::$kernel->getContainer()->getParameter('kernel.root_dir').'/web';
$this->cacheRoot = $this->webRoot.'/'.self::$kernel->getContainer()->getParameter('liip_imagine.cache_prefix');
$this->cacheRoot = $this->webRoot.'/media/cache';

$this->filesystem = new Filesystem;
$this->filesystem->remove($this->cacheRoot);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/Controller/ImagineControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function setUp()
$this->client = $this->createClient();

$this->webRoot = self::$kernel->getContainer()->getParameter('kernel.root_dir').'/web';
$this->cacheRoot = $this->webRoot.'/'.self::$kernel->getContainer()->getParameter('liip_imagine.cache_prefix');
$this->cacheRoot = $this->webRoot.'/media/cache';

$this->filesystem = new Filesystem;
$this->filesystem->remove($this->cacheRoot);
Expand Down
5 changes: 2 additions & 3 deletions Tests/Functional/app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
_imagine:
resource: .
type: imagine
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.xml"
5 changes: 3 additions & 2 deletions Tests/Imagine/Cache/CacheManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ public function testGenerateUrl()
->expects($this->once())
->method('generate')
->with(
'_imagine_thumbnail',
'liip_imagine_filter',
array(
'path' => $path
'path' => $path,
'filter' => 'thumbnail',
),
true
)
Expand Down
68 changes: 0 additions & 68 deletions Tests/Routing/ImagineLoaderTest.php

This file was deleted.

18 changes: 16 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
Upgrade
=======

0.19.x to 1.0.0
1.0.0-alpha5 to 1.0.0-alpha6

* [Route] `ImagineLoader` was removed. Please adjust your `app/config/routing.yml` file.

```diff
-_imagine:
- resource: .
- type: imagine
+_liip_imagine:
+ resource: "@LiipImagineBundle/Resources/config/routing.xml"
```

* [Configuration] `liip_imagine.filter_sets.route` option and sub options were removed.
* [Configuration] `liip_imagine.cache_prefix` option was removed.

0.19.x to 1.0.0-alpha5
---------------

* [Symfony] Required minimum symfony version was updated to 2.3.
Expand Down Expand Up @@ -40,7 +55,6 @@ Upgrade
* [Configuration] `liip_imagine.filter_sets.path` option was removed.
* [Configuration] `liip_imagine.filter_sets.format` option was removed.
* [Configuration] `liip_imagine.cache_mkdir_mode` option was removed.
* [Configuration] `liip_imagine.cache_prefix` option was removed.
* [Configuration] `liip_imagine.web_root` option was removed.
* [Configuration] `liip_imagine.cache` default value was changed from `web_path`to `default`.
* [Configuration] `liip_imagine.formats` option was removed.
Expand Down

0 comments on commit e3a28ed

Please sign in to comment.