Skip to content

Commit 18e697c

Browse files
authored
Merge pull request #3 from bookboon/feature/sf4
Feature/sf4
2 parents fec3bf1 + e6a9fc2 commit 18e697c

5 files changed

Lines changed: 16 additions & 14 deletions

File tree

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=5.6.0",
18-
"bookboon/api": "^3.0"
17+
"php": ">=5.6",
18+
"symfony/dependency-injection": "~4.0",
19+
"symfony/config": "~4.0",
20+
"bookboon/api": "~3.0"
1921
},
2022
"autoload": {
2123
"psr-4": {

src/Bookboon/ApiBundle/DependencyInjection/BookboonApiExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Bookboon\ApiBundle\DependencyInjection;
44

5+
use Bookboon\Api\Cache\Cache;
56
use Bookboon\ApiBundle\Configuration\ApiConfiguration;
67
use Bookboon\ApiBundle\Helper\ConfigurationHolder;
78
use Symfony\Component\Config\FileLocator;
@@ -24,11 +25,11 @@ public function load(array $configs, ContainerBuilder $container)
2425
{
2526
$config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs);
2627

27-
$container->register("bookboonapi.config", ConfigurationHolder::class)
28+
$container->register(ConfigurationHolder::class, ConfigurationHolder::class)
2829
->addArgument($config)
2930
->setPublic(false);
3031

31-
$container->setAlias("bookboonapi.cache", $config['cache_service']);
32+
$container->setAlias(Cache::class, $config['cache_service']);
3233

3334
$loader = new YamlFileLoader(
3435
$container,

src/Bookboon/ApiBundle/DependencyInjection/Configuration.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Bookboon\ApiBundle\DependencyInjection;
44

5+
use Bookboon\Api\Cache\RedisCache;
56
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
67
use Symfony\Component\Config\Definition\ConfigurationInterface;
78

@@ -23,9 +24,9 @@ public function getConfigTreeBuilder()
2324
->scalarNode('branding')->end()
2425
->scalarNode('rotation')->end()
2526
->scalarNode('currency')->end()
26-
->scalarNode('client_id')->defaultNull()->end()
27+
->scalarNode('impersonator_id')->defaultNull()->end()
2728
->scalarNode('redirect')->defaultNull()->end()
28-
->scalarNode('cache_service')->defaultValue("bookboonapi.cache.redis")->end()
29+
->scalarNode('cache_service')->defaultValue(RedisCache::class)->end()
2930
->arrayNode('languages')->isRequired()->prototype('scalar')->end()->end()
3031
->arrayNode('scopes')->isRequired()->prototype('scalar')->end()->end()
3132
->integerNode('premiumlevel')->end()

src/Bookboon/ApiBundle/Helper/ConfigurationHolder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public function getCurrency()
7575
/**
7676
* @return string
7777
*/
78-
public function getClientId()
78+
public function getImpersonatorId()
7979
{
80-
return isset($this->_config['client_id']) ? $this->_config['client_id'] : null;
80+
return isset($this->_config['impersonator_id']) ? $this->_config['impersonator_id'] : null;
8181
}
8282

8383

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
services:
2-
bookboonapi.cache.redis:
3-
class: Bookboon\Api\Cache\RedisCache
2+
Bookboon\Api\Cache\RedisCache:
43
public: false
54
arguments: []
65

7-
bookboonapi:
8-
class: Bookboon\Api\Bookboon
6+
Bookboon\Api\Bookboon:
97
public: true
108
factory: ['Bookboon\ApiBundle\Service\ApiFactory', create]
119
arguments:
12-
- "@bookboonapi.config"
13-
- "@bookboonapi.cache"
10+
- '@Bookboon\ApiBundle\Helper\ConfigurationHolder'
11+
- '@Bookboon\Api\Cache\Cache'

0 commit comments

Comments
 (0)