Skip to content

Commit

Permalink
move storage factory init from PayumBundle::build to PayumExtension::…
Browse files Browse the repository at this point in the history
…load
  • Loading branch information
lsmith77 committed Nov 24, 2017
1 parent 7b1dd15 commit 08f6924
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
11 changes: 11 additions & 0 deletions DependencyInjection/PayumExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\CustomStorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\Propel1StorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\Propel2StorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\DoctrineStorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\FilesystemStorageFactory;

class PayumExtension extends Extension implements PrependExtensionInterface
{
Expand All @@ -37,6 +42,12 @@ public function load(array $configs, ContainerBuilder $container)

$config = $this->processConfiguration($mainConfig, $configs);

$this->addStorageFactory(new FilesystemStorageFactory);
$this->addStorageFactory(new DoctrineStorageFactory);
$this->addStorageFactory(new CustomStorageFactory);
$this->addStorageFactory(new Propel1StorageFactory);
$this->addStorageFactory(new Propel2StorageFactory);

// load services
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('payum.xml');
Expand Down
15 changes: 0 additions & 15 deletions PayumBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
use Payum\Bundle\PayumBundle\DependencyInjection\Compiler\BuildGatewayFactoriesPass;
use Payum\Bundle\PayumBundle\DependencyInjection\Compiler\BuildGatewaysPass;
use Payum\Bundle\PayumBundle\DependencyInjection\Compiler\BuildStoragesPass;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\CustomStorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\Propel1StorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\Propel2StorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\DoctrineStorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\Factory\Storage\FilesystemStorageFactory;
use Payum\Bundle\PayumBundle\DependencyInjection\PayumExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;

Expand All @@ -21,15 +15,6 @@ public function build(ContainerBuilder $container)
{
parent::build($container);

/** @var $extension PayumExtension */
$extension = $container->getExtension('payum');

$extension->addStorageFactory(new FilesystemStorageFactory);
$extension->addStorageFactory(new DoctrineStorageFactory);
$extension->addStorageFactory(new CustomStorageFactory);
$extension->addStorageFactory(new Propel1StorageFactory);
$extension->addStorageFactory(new Propel2StorageFactory);

$container->addCompilerPass(new BuildConfigsPass());
$container->addCompilerPass(new BuildGatewaysPass);
$container->addCompilerPass(new BuildStoragesPass);
Expand Down

0 comments on commit 08f6924

Please sign in to comment.