This commit is contained in:
Cyprian Beauvois 2019-02-19 11:33:05 +01:00
parent a26c178dbb
commit 75f2bbd173
2 changed files with 18 additions and 2 deletions

View File

@ -5,4 +5,5 @@ services:
Bluesquare\Validator:
class: Bluesquare\ValidatorBundle
autowire: true
arguments: ['@request_stack']
autoconfigure: true
arguments: ['@symfony/request-stack']

View File

@ -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');
}
}