Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move storage factory init from PayumBundle::build to PayumExtension::load #443

Merged
merged 1 commit into from
Dec 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -33,6 +38,12 @@ class PayumExtension extends Extension implements PrependExtensionInterface
*/
public function load(array $configs, ContainerBuilder $container)
{
$this->addStorageFactory(new FilesystemStorageFactory);
$this->addStorageFactory(new DoctrineStorageFactory);
$this->addStorageFactory(new CustomStorageFactory);
$this->addStorageFactory(new Propel1StorageFactory);
$this->addStorageFactory(new Propel2StorageFactory);

$mainConfig = $this->getConfiguration($configs, $container);

$config = $this->processConfiguration($mainConfig, $configs);
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
7 changes: 0 additions & 7 deletions Tests/Functional/DependencyInjection/PayumExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public function shouldAddGatewayTagWithCorrectGatewayAndFactoryNamesSet()
$containerBuilder->setParameter('kernel.debug', false);

$extension = new PayumExtension;
$extension->addStorageFactory(new FilesystemStorageFactory);

$extension->load($configs, $containerBuilder);

Expand Down Expand Up @@ -91,7 +90,6 @@ public function shouldUsePayumBuilderServiceToBuildPayumService()
$containerBuilder->setParameter('kernel.debug', false);

$extension = new PayumExtension;
$extension->addStorageFactory(new FilesystemStorageFactory);

$extension->load($configs, $containerBuilder);

Expand Down Expand Up @@ -140,7 +138,6 @@ public function shouldSetGatewayConfigStorageToPayumBuilderIfConfigured()
$containerBuilder->setParameter('kernel.debug', false);

$extension = new PayumExtension;
$extension->addStorageFactory(new FilesystemStorageFactory);

$extension->load($configs, $containerBuilder);

Expand Down Expand Up @@ -192,7 +189,6 @@ public function shouldWrapGatewayConfigStorageByEncryptionDecoratorWhenDefuseEnc
$container->setParameter('kernel.debug', false);

$extension = new PayumExtension;
$extension->addStorageFactory(new FilesystemStorageFactory);

$extension->load($configs, $container);

Expand Down Expand Up @@ -246,7 +242,6 @@ public function shouldConfigureSonataAdminClassForGatewayConfigModelSetInStorage
$containerBuilder->setParameter('kernel.debug', false);

$extension = new PayumExtension;
$extension->addStorageFactory(new FilesystemStorageFactory);

$extension->load($configs, $containerBuilder);

Expand Down Expand Up @@ -303,7 +298,6 @@ public function shouldInjectCypherToForGatewayConfigAdmin()
$containerBuilder->setParameter('kernel.debug', false);

$extension = new PayumExtension;
$extension->addStorageFactory(new FilesystemStorageFactory);

$extension->load($configs, $containerBuilder);

Expand Down Expand Up @@ -354,7 +348,6 @@ public function shouldNotConfigureSonataAdminClassForGatewayConfigIfDisabled()
$containerBuilder->setParameter('kernel.debug', false);

$extension = new PayumExtension;
$extension->addStorageFactory(new FilesystemStorageFactory);

$extension->load($configs, $containerBuilder);

Expand Down