diff --git a/DependencyInjection/DdeboerSalesforceMapperExtension.php b/DependencyInjection/LogicItLabSalesforceMapperExtension.php similarity index 84% rename from DependencyInjection/DdeboerSalesforceMapperExtension.php rename to DependencyInjection/LogicItLabSalesforceMapperExtension.php index 80a0e48..8998c43 100644 --- a/DependencyInjection/DdeboerSalesforceMapperExtension.php +++ b/DependencyInjection/LogicItLabSalesforceMapperExtension.php @@ -12,7 +12,7 @@ * * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} */ -class SalesforceMapperExtension extends Extension +class LogicItLabSalesforceMapperExtension extends Extension { /** * {@inheritDoc} @@ -23,7 +23,10 @@ public function load(array $configs, ContainerBuilder $container) $config = $this->processConfiguration($configuration, $configs); $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.xml'); + //$loader->load('services.xml'); + + $yamlLoader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $yamlLoader->load('services.yaml'); if (isset($config['cache_driver'])) { switch ($config['cache_driver']) { diff --git a/Request/ParamConverter/SalesforceParamConverter.php b/Request/ParamConverter/SalesforceParamConverter.php index 564d00d..398c931 100644 --- a/Request/ParamConverter/SalesforceParamConverter.php +++ b/Request/ParamConverter/SalesforceParamConverter.php @@ -7,6 +7,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface; use LogicItLab\Salesforce\MapperBundle\Mapper; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; /** * This param converter convers a Salesforce id into a Salesforce object, using @@ -40,7 +41,7 @@ public function __construct(Mapper $mapper, array $mappings) /** * {@inheritdoc} */ - public function apply(Request $request, ConfigurationInterface $configuration) + public function apply(Request $request, ParamConverter $configuration) { // @todo Is it smart to do this based on variable name? Perhaps it's // better to, here also, look at class name? @@ -63,7 +64,7 @@ public function apply(Request $request, ConfigurationInterface $configuration) /** * {@inheritdoc} */ - public function supports(ConfigurationInterface $configuration) + public function supports(ParamConverter $configuration) { return in_array($configuration->getClass(), $this->mappings); } diff --git a/Resources/config/services.yaml b/Resources/config/services.yaml new file mode 100644 index 0000000..483bcdc --- /dev/null +++ b/Resources/config/services.yaml @@ -0,0 +1,32 @@ +services: + # default configuration for services in *this* file + _defaults: + autowire: true # Automatically injects dependencies in your services. + autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + public: false # Allows optimizing the container by removing unused services; this also means + # fetching services directly from the container via $container->get() won't work. + # The best practice is to be explicit about your dependencies anyway. + + LogicItLab\Salesforce\MapperBundle\: + resource: '../../*' + exclude: '../../{Tests}' + + LogicItLab\Salesforce\MapperBundle\Mapper: + arguments: + - '@phpforce.soap_client' + - '@LogicItLab\Salesforce\MapperBundle\Annotation\AnnotationReader' + - '@LogicItLab\Salesforce\MapperBundle\Cache\FileCache' + + LogicItLab\Salesforce\MapperBundle\Cache\FileCache: + arguments: + - '%kernel.cache_dir%/salesforce' + + LogicItLab\Salesforce\MapperBundle\Annotation\AnnotationReader: + arguments: + - '@annotation_reader' + + LogicItLab\Salesforce\MapperBundle\MappedBulkSaver: + arguments: + - '@phpforce.soap_client.bulk_saver' + - '@LogicItLab\Salesforce\MapperBundle\Mapper' + - '@LogicItLab\Salesforce\MapperBundle\Annotation\AnnotationReader'