* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Bundle\WebServiceBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; /** * WebServiceExtension. * * @author Christian Kerl */ class WebServiceExtension extends Extension { public function configLoad(array $config, ContainerBuilder $configuration) { if(!$configuration->hasDefinition('webservice_http_kernel')) { $loader = new XmlFileLoader($configuration, __DIR__ . '/../Resources/config'); $loader->load('services.xml'); $configuration->setAlias('http_kernel', 'webservice.kernel'); } if(!isset($config['definition'])) { throw new \InvalidArgumentException(); } $this->registerServiceDefinitionConfig($config['definition'], $configuration); } protected function registerServiceDefinitionConfig(array $config, ContainerBuilder $configuration) { if(!isset($config['name'])) { throw new \InvalidArgumentException(); } $configuration->setParameter('webservice.definition.name', $config['name']); $configuration->setParameter('webservice.definition.resource', isset($config['resource']) ? $config['resource'] : null); } public function getXsdValidationBasePath() { return null; } public function getNamespace() { return null; } public function getAlias() { return 'webservice'; } }