diff --git a/DependencyInjection/SimpleThingsTransactionalExtension.php b/DependencyInjection/SimpleThingsTransactionalExtension.php
index 4a4d3f7..065707c 100644
--- a/DependencyInjection/SimpleThingsTransactionalExtension.php
+++ b/DependencyInjection/SimpleThingsTransactionalExtension.php
@@ -15,6 +15,7 @@
namespace SimpleThings\TransactionalBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
diff --git a/Doctrine/ObjectTransactionStatus.php b/Doctrine/ObjectTransactionStatus.php
index 0823e6c..9af5c97 100644
--- a/Doctrine/ObjectTransactionStatus.php
+++ b/Doctrine/ObjectTransactionStatus.php
@@ -72,7 +72,7 @@ public function setRollBackOnly()
*/
public function isCompleted()
{
- return $this->isCompleted;
+ return $this->completed;
}
/**
diff --git a/Doctrine/OrmTransactionStatus.php b/Doctrine/OrmTransactionStatus.php
index f64f9b7..d0e3fe1 100644
--- a/Doctrine/OrmTransactionStatus.php
+++ b/Doctrine/OrmTransactionStatus.php
@@ -70,7 +70,7 @@ public function setRollBackOnly()
*/
public function isCompleted()
{
- return $this->isCompleted;
+ return $this->completed;
}
/**
@@ -110,8 +110,8 @@ public function commit()
if ( ! $this->isRollBackOnly() && $this->manager->getConnection()->getTransactionNestingLevel() == 1) {
$this->manager->flush();
+ $this->manager->getConnection()->commit();
}
- $this->manager->commit();
if ($this->manager->getConnection()->getTransactionNestingLevel() == 0) {
$this->completed = true;
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 6482de7..36f5f8d 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -35,7 +35,12 @@
+
+
+
+
+
diff --git a/SimpleThingsTransactionalBundle.php b/SimpleThingsTransactionalBundle.php
index 5ef2745..6480d47 100644
--- a/SimpleThingsTransactionalBundle.php
+++ b/SimpleThingsTransactionalBundle.php
@@ -16,7 +16,7 @@
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use SimpleThings\TransactionalBundle\DependencyInjection\CompilerPass\DetectConnectionsPass;
+use SimpleThings\TransactionalBundle\DependencyInjection\CompilerPass\DetectConnectionPass;
class SimpleThingsTransactionalBundle extends Bundle
{
@@ -24,6 +24,6 @@ public function build(ContainerBuilder $container)
{
parent::build($container);
- $container->addCompilerPass(new DetectConnectionsPass());
+ $container->addCompilerPass(new DetectConnectionPass());
}
}
diff --git a/Transactions/Form/RollbackInvalidFormExtension.php b/Transactions/Form/RollbackInvalidFormExtension.php
index 9e374bd..05a5317 100644
--- a/Transactions/Form/RollbackInvalidFormExtension.php
+++ b/Transactions/Form/RollbackInvalidFormExtension.php
@@ -15,13 +15,19 @@
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilder;
-use Symfony\Component\Form\AbstractExtension;
-class RollbackInvalidFormExtension extends AbstractExtension
+class RollbackInvalidFormExtension extends AbstractTypeExtension
{
+ private $validator;
+
+ public function __construct(RollbackInvalidFormValidator $rollbackValidator)
+ {
+ $this->validator = $rollbackValidator;
+ }
+
public function buildForm(FormBuilder $builder, array $options)
{
- $builder->addValidator(new RollbackInvalidFormValidator());
+ $builder->addValidator($this->validator);
}
public function getExtendedType()
diff --git a/Transactions/Form/RollbackInvalidFormValidator.php b/Transactions/Form/RollbackInvalidFormValidator.php
index 6cfce63..1cfda71 100644
--- a/Transactions/Form/RollbackInvalidFormValidator.php
+++ b/Transactions/Form/RollbackInvalidFormValidator.php
@@ -11,10 +11,10 @@
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
-namespace SimpleThingsTransactionalBundle\Transactions\Form;
+namespace SimpleThings\TransactionalBundle\Transactions\Form;
use Symfony\Component\Form\FormValidatorInterface;
-use Symfony\Component\Form\Form;
+use Symfony\Component\Form\FormInterface;
/**
* "Missusing" the FormValidator to set transactions to rollback only when the validation failed.
@@ -39,7 +39,7 @@ public function validate(FormInterface $form)
}
$request = $this->container->get('request');
- if ( ! $form->isValid( && $request->attributes->has('_transaction') ) {
+ if ( ! $form->isValid() && $request->attributes->has('_transaction') ) {
$request->attributes->get('_transaction')->setRollBackOnly(true);
}
}
diff --git a/Transactions/Http/HttpTransactionsListener.php b/Transactions/Http/HttpTransactionsListener.php
index dc96edd..00b2ce2 100644
--- a/Transactions/Http/HttpTransactionsListener.php
+++ b/Transactions/Http/HttpTransactionsListener.php
@@ -19,7 +19,7 @@
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
-use Symfony\Component\HttpFoundation\Exceptions\NotFoundHttpException;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use SimpleThings\TransactionalBundle\Transactions\TransactionsRegistry;
/**