Skip to content

Commit

Permalink
brought up to speed with symfony HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
schmittjoh committed Feb 25, 2011
1 parent 9b9fd32 commit 9031f5b
Show file tree
Hide file tree
Showing 74 changed files with 678 additions and 611 deletions.
2 changes: 1 addition & 1 deletion BrowserKit/Request.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\BrowserKit;
namespace JMS\Payment\CoreBundle\BrowserKit;

use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpFoundation\ParameterBag;
Expand Down
12 changes: 6 additions & 6 deletions Controller/DemoController.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Controller;
namespace JMS\Payment\CoreBundle\Controller;

use Bundle\JMS\Payment\CorePaymentBundle\PluginController\Result;
use JMS\Payment\CoreBundle\PluginController\Result;

use Bundle\JMS\Payment\CorePaymentBundle\Plugin\Exception\ActionRequiredException;
use Bundle\JMS\Payment\CorePaymentBundle\Plugin\Exception\Action\VisitUrl;
use Bundle\JMS\Payment\CorePaymentBundle\Entity\ExtendedData;
use Bundle\JMS\Payment\CorePaymentBundle\Entity\PaymentInstruction;
use JMS\Payment\CoreBundle\Plugin\Exception\ActionRequiredException;
use JMS\Payment\CoreBundle\Plugin\Exception\Action\VisitUrl;
use JMS\Payment\CoreBundle\Entity\ExtendedData;
use JMS\Payment\CoreBundle\Entity\PaymentInstruction;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/*
Expand Down
2 changes: 1 addition & 1 deletion Cryptography/EncryptionServiceInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Cryptography;
namespace JMS\Payment\CoreBundle\Cryptography;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion Cryptography/MCryptEncryptionService.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Cryptography;
namespace JMS\Payment\CoreBundle\Cryptography;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
38 changes: 38 additions & 0 deletions DependencyInjection/Compiler/AddPaymentPluginsPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace JMS\Payment\CoreBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/*
* Copyright 2011 Johannes M. Schmitt <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

class AddPaymentPluginsPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('payment.plugin_controller')) {
return;
}

$def = $container->getDefinition('payment.plugin_controller');
foreach ($container->findTaggedServiceIds('payment.plugin') as $id => $attr) {
$def->addMethodCall('addPlugin', array(new Reference($id)));
}
}
}
35 changes: 35 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace JMS\Payment\CoreBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

class Configuration
{
public function getConfigTree()
{
$tb = new TreeBuilder();

return $tb
->root('jms_payment_core', 'array')
->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()
->end()
->buildTree();
}
}
44 changes: 44 additions & 0 deletions DependencyInjection/JMSPaymentCoreExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace JMS\Payment\CoreBundle\DependencyInjection;

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

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

class JMSPaymentCoreExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$xmlLoader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$xmlLoader->load('payment.xml');

$configuration = new Configuration();
$processor = new Processor();
$config = $processor->process($configuration->getConfigTree(), $configs);

if (isset($config['secret'])) {
$container->setParameter('payment.encryption_service.secret', $config['secret']);
}
}
}
65 changes: 0 additions & 65 deletions DependencyInjection/PaymentExtension.php

This file was deleted.

10 changes: 5 additions & 5 deletions Entity/Credit.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Entity;
namespace JMS\Payment\CoreBundle\Entity;

use Bundle\JMS\Payment\CorePaymentBundle\Model\CreditInterface;
use Bundle\JMS\Payment\CorePaymentBundle\Model\FinancialTransactionInterface;
use Bundle\JMS\Payment\CorePaymentBundle\Model\PaymentInstructionInterface;
use Bundle\JMS\Payment\CorePaymentBundle\Model\PaymentInterface;
use JMS\Payment\CoreBundle\Model\CreditInterface;
use JMS\Payment\CoreBundle\Model\FinancialTransactionInterface;
use JMS\Payment\CoreBundle\Model\PaymentInstructionInterface;
use JMS\Payment\CoreBundle\Model\PaymentInterface;
use Doctrine\Common\Collections\ArrayCollection;

/*
Expand Down
4 changes: 2 additions & 2 deletions Entity/ExtendedData.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Entity;
namespace JMS\Payment\CoreBundle\Entity;

use Bundle\JMS\Payment\CorePaymentBundle\Model\ExtendedDataInterface;
use JMS\Payment\CoreBundle\Model\ExtendedDataInterface;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions Entity/ExtendedDataType.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Entity;
namespace JMS\Payment\CoreBundle\Entity;

use Bundle\JMS\Payment\CorePaymentBundle\Cryptography\EncryptionServiceInterface;
use JMS\Payment\CoreBundle\Cryptography\EncryptionServiceInterface;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\ObjectType;
Expand Down
10 changes: 5 additions & 5 deletions Entity/FinancialTransaction.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Entity;
namespace JMS\Payment\CoreBundle\Entity;

use Bundle\JMS\Payment\CorePaymentBundle\Model\CreditInterface;
use Bundle\JMS\Payment\CorePaymentBundle\Model\ExtendedDataInterface;
use Bundle\JMS\Payment\CorePaymentBundle\Model\FinancialTransactionInterface;
use Bundle\JMS\Payment\CorePaymentBundle\Model\PaymentInterface;
use JMS\Payment\CoreBundle\Model\CreditInterface;
use JMS\Payment\CoreBundle\Model\ExtendedDataInterface;
use JMS\Payment\CoreBundle\Model\FinancialTransactionInterface;
use JMS\Payment\CoreBundle\Model\PaymentInterface;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
6 changes: 3 additions & 3 deletions Entity/Payment.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Entity;
namespace JMS\Payment\CoreBundle\Entity;

use Bundle\JMS\Payment\CorePaymentBundle\Model\FinancialTransactionInterface;
use Bundle\JMS\Payment\CorePaymentBundle\Model\PaymentInterface;
use JMS\Payment\CoreBundle\Model\FinancialTransactionInterface;
use JMS\Payment\CoreBundle\Model\PaymentInterface;
use Doctrine\Common\Collections\ArrayCollection;

/*
Expand Down
4 changes: 2 additions & 2 deletions Entity/PaymentInstruction.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Entity;
namespace JMS\Payment\CoreBundle\Entity;

use Bundle\JMS\Payment\CorePaymentBundle\Model\PaymentInstructionInterface;
use JMS\Payment\CoreBundle\Model\PaymentInstructionInterface;
use Doctrine\Common\Collections\ArrayCollection;

/*
Expand Down
2 changes: 1 addition & 1 deletion Exception/Exception.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Exception;
namespace JMS\Payment\CoreBundle\Exception;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
20 changes: 15 additions & 5 deletions CorePaymentBundle.php → JMSPaymentCoreBundle.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle;
namespace JMS\Payment\CoreBundle;

use Bundle\JMS\Payment\CorePaymentBundle\Entity\ExtendedDataType;
use JMS\Payment\CoreBundle\DependencyInjection\Compiler\AddPaymentPluginsPass;

use Symfony\Component\DependencyInjection\ContainerBuilder;

use JMS\Payment\CoreBundle\Entity\ExtendedDataType;
use Doctrine\DBAL\Types\Type;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand All @@ -22,14 +26,20 @@
* limitations under the License.
*/

class CorePaymentBundle extends Bundle
class JMSPaymentCoreBundle extends Bundle
{
public function boot()
{
// FIXME: only add type when using Doctrine2 entities
if (false === Type::hasType(ExtendedDataType::NAME)) {
ExtendedDataType::setEncryptionService($this->container->get('payment.encryption_service'));
Type::addType(ExtendedDataType::NAME, 'Bundle\JMS\Payment\CorePaymentBundle\Entity\ExtendedDataType');
Type::addType(ExtendedDataType::NAME, 'JMS\Payment\CoreBundle\Entity\ExtendedDataType');
}
}

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

$builder->addCompilerPass(new AddPaymentPluginsPass());
}
}
2 changes: 1 addition & 1 deletion Model/CreditInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Model;
namespace JMS\Payment\CoreBundle\Model;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion Model/ExtendedDataInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Model;
namespace JMS\Payment\CoreBundle\Model;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion Model/FinancialTransactionInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Model;
namespace JMS\Payment\CoreBundle\Model;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion Model/PaymentInstructionInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bundle\JMS\Payment\CorePaymentBundle\Model;
namespace JMS\Payment\CoreBundle\Model;

/*
* Copyright 2010 Johannes M. Schmitt <[email protected]>
Expand Down
Loading

0 comments on commit 9031f5b

Please sign in to comment.