Skip to content

Commit

Permalink
Merge pull request #174 from greg0ire/fix_caching_issue
Browse files Browse the repository at this point in the history
Implement configuration outside the pass
  • Loading branch information
psrpinto authored Aug 18, 2016
2 parents 8280335 + 1f1d5c9 commit 9a97749
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 41 deletions.
36 changes: 0 additions & 36 deletions DependencyInjection/Compiler/RegisterExtendedDataTypePass.php

This file was deleted.

21 changes: 17 additions & 4 deletions DependencyInjection/JMSPaymentCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
namespace JMS\Payment\CoreBundle\DependencyInjection;

use JMS\Payment\CoreBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\FileLocator;
use JMS\Payment\CoreBundle\Entity\ExtendedDataType;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Kernel;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand All @@ -27,8 +29,19 @@
* limitations under the License.
*/

class JMSPaymentCoreExtension extends Extension
class JMSPaymentCoreExtension extends Extension implements PrependExtensionInterface
{
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('doctrine', array(
'dbal' => array(
'types' => array(
ExtendedDataType::NAME => 'JMS\Payment\CoreBundle\Entity\ExtendedDataType'
)
)
));
}

public function load(array $configs, ContainerBuilder $container)
{
$xmlLoader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
Expand All @@ -46,4 +59,4 @@ public function load(array $configs, ContainerBuilder $container)
$container->removeDefinition('payment.form.choose_payment_method_type');
}
}
}
}
6 changes: 5 additions & 1 deletion JMSPaymentCoreBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@

class JMSPaymentCoreBundle extends Bundle
{
public function boot()
{
ExtendedDataType::setEncryptionService($this->container->get('payment.encryption_service'));
}

public function build(ContainerBuilder $builder)
{
parent::build($builder);

$builder->addCompilerPass(new AddPaymentPluginsPass());
$builder->addCompilerPass(new AddPaymentMethodFormTypesPass());
$builder->addCompilerPass(new RegisterExtendedDataTypePass());
}
}

0 comments on commit 9a97749

Please sign in to comment.