This commit is contained in:
Pol Dellaiera 2021-08-10 15:53:12 +02:00 committed by Marc Ducobu
parent 0ee286ce27
commit 646a626019
5 changed files with 16 additions and 23 deletions

View File

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

View File

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

View File

@ -21,14 +21,9 @@ return static function (ContainerConfigurator $container) {
->autoconfigure();
$services
->load('ChampsLibres\\WopiTestBundle\\Service\\', __DIR__ . '/../../Service');
->load('Chill\\WopiBundle\\Service\\', __DIR__ . '/../../Service');
$services
->load('Chill\\WopiBundle\\Controller\\', __DIR__ . '/../../Controller')
->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
declare(strict_types=1);
namespace Chill\WopiBundle\Service\OpenStack;
use OpenStack\OpenStack;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
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
declare(strict_types=1);
namespace Chill\WopiBundle\Service\OpenStack;
interface OpenStackClientInterface