This commit is contained in:
Pol Dellaiera 2021-08-10 15:53:12 +02:00
parent 12e17fac82
commit df544bdfa4
5 changed files with 16 additions and 23 deletions

View File

@ -10,24 +10,20 @@ declare(strict_types=1);
namespace Chill\WopiBundle\Controller; namespace Chill\WopiBundle\Controller;
use Chill\WopiBundle\Service\OpenStack\OpenStackClientInterface; use Chill\WopiBundle\Service\OpenStack\OpenStackClientInterface;
use OpenStack\OpenStack;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
final class Test final class Test
{ {
private OpenStackClientInterface $client; private OpenStackClientInterface $client;
private OpenStack $osClient; public function __construct(OpenStackClientInterface $client)
public function __construct(OpenStackClientInterface $client, OpenStack $osClient)
{ {
$this->client = $client; $this->client = $client;
$this->osClient = $osClient;
} }
public function __invoke() public function __invoke()
{ {
dump($this->osClient); dump($this->client);
return new Response('fobar'); return new Response('fobar');
} }

View File

@ -23,17 +23,7 @@ final class ChillWopiExtension extends Extension
$container $container
->setParameter( ->setParameter(
'chill_wopi', 'chill_wopi',
$this->processConfiguration(new Configuration(), $configs) $config
);
var_dump($config);
$container
->setParameter(
'chill_wopi.openstack_client',
$config['openstack']
); );
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

View File

@ -21,14 +21,9 @@ return static function (ContainerConfigurator $container) {
->autoconfigure(); ->autoconfigure();
$services $services
->load('ChampsLibres\\WopiTestBundle\\Service\\', __DIR__ . '/../../Service'); ->load('Chill\\WopiBundle\\Service\\', __DIR__ . '/../../Service');
$services $services
->load('Chill\\WopiBundle\\Controller\\', __DIR__ . '/../../Controller') ->load('Chill\\WopiBundle\\Controller\\', __DIR__ . '/../../Controller')
->tag('controller.service_arguments'); ->tag('controller.service_arguments');
$services
->set('chill_wopi.openstack_client')
->class(OpenStack::class)
->arg('$options', '%chill_wopi.openstack_client%');
}; };

View File

@ -1,10 +1,20 @@
<?php <?php
declare(strict_types=1);
namespace Chill\WopiBundle\Service\OpenStack; namespace Chill\WopiBundle\Service\OpenStack;
use OpenStack\OpenStack; use OpenStack\OpenStack;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
final class Client extends OpenStack implements OpenStackClientInterface final class Client extends OpenStack implements OpenStackClientInterface
{ {
private ParameterBagInterface $parameterBag;
public function __construct(ParameterBagInterface $parameterBag)
{
$configuration = $parameterBag->get('chill_wopi');
parent::__construct($configuration['openstack']);
}
} }

View File

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace Chill\WopiBundle\Service\OpenStack; namespace Chill\WopiBundle\Service\OpenStack;
interface OpenStackClientInterface interface OpenStackClientInterface