From 75f2bbd173fabc10d98b350f7ecb16d22c050822 Mon Sep 17 00:00:00 2001 From: cbeauvoi Date: Tue, 19 Feb 2019 11:33:05 +0100 Subject: [PATCH] test --- Ressources/config/services.yaml | 3 ++- src/ValidatorBundle.php | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Ressources/config/services.yaml b/Ressources/config/services.yaml index ce4ad7f..9c10187 100644 --- a/Ressources/config/services.yaml +++ b/Ressources/config/services.yaml @@ -5,4 +5,5 @@ services: Bluesquare\Validator: class: Bluesquare\ValidatorBundle autowire: true - arguments: ['@request_stack'] + autoconfigure: true + arguments: ['@symfony/request-stack'] diff --git a/src/ValidatorBundle.php b/src/ValidatorBundle.php index 2d20690..f7cc467 100644 --- a/src/ValidatorBundle.php +++ b/src/ValidatorBundle.php @@ -2,12 +2,16 @@ namespace Bluesquare; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpKernel\Config\FileLocator; use Symfony\Contracts\Translation\TranslatorInterface; use Traversable; -class ValidatorBundle +class ValidatorBundle extends Extension { protected $request; protected $context; @@ -440,4 +444,15 @@ class ValidatorBundle $words = array_map('ucfirst', explode('_', $string)); return implode('', $words); } + + /** + * Loads a specific configuration. + * + * @throws \InvalidArgumentException When provided tag is not defined in this extension + */ + public function load(array $configs, ContainerBuilder $container) + { + $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '../Ressources/config')); + $loader->load('services.yaml'); + } }