Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
edd590f
䅤摥搠瑥獴猠景爠呲慮獡捴楯湡汍慴捨敲�
yethee Dec 20, 2011
84aa839
Fixed a class name
yethee Dec 20, 2011
9627d7f
Merge pull request #6 from yethee/tests_and_fixes
beberlei Jan 6, 2012
92fce37
Merge pull request #7 from yethee/em_transaction
beberlei Jan 6, 2012
284913b
Start refactoring away from wrapper
beberlei Jan 6, 2012
4ef43e1
Merge branch 'master' of github.com:simplethings/SimpleThingsTransact…
beberlei Jan 7, 2012
a2f255e
Checkpoint Refactoring. Removed all old Managers, reworked Transactio…
beberlei Jan 7, 2012
0a52ba7
Remove Request dependency from TransactionalMatcher
beberlei Jan 7, 2012
f6b794f
Implement and test AbstractTransactionManager, Rename ControllerListe…
beberlei Jan 7, 2012
24f3b82
Move all non-configuration Files under Transactions namespace. Testin…
beberlei Jan 8, 2012
e44abbb
Implement ObjectTransactionManager and Status. Started writing DESIGN…
beberlei Jan 8, 2012
bec3deb
Remove HttpTransactionsListener in Controller folder
beberlei Jan 8, 2012
6b5f83d
Refactor towards Transactional Scope
beberlei Jan 8, 2012
7f8e51f
Add Functional Test, work on configuration, add OrmTransactionManager.
beberlei Jan 8, 2012
b7a05ac
Typo
beberlei Jan 8, 2012
b11b03f
Simplified transactions code by allowing only one manager per request…
beberlei Jan 21, 2012
ca42251
Get rid of the PROPAGATION, ISOLATION overhead and back to simple again.
beberlei Jan 26, 2012
eb6ee97
More renaming, get rid of managers, only have providers, registry man…
beberlei Jan 26, 2012
c03fba8
Remove txdef from request
beberlei Jan 26, 2012
51149fd
Further refactoring, cleaned up DI extension, added tests for Container
beberlei Jan 26, 2012
94e9a6d
Fix Form Support
beberlei Jan 26, 2012
ccfbc51
Update README
beberlei Jan 26, 2012
bdaf28f
Test Object/ORM Providers and fix some bugs.
beberlei Jan 29, 2012
e5b8a29
Fix use statements
yethee Mar 20, 2012
4c036a3
Extracted dependency of the validator, inject it through the construc…
yethee Mar 20, 2012
ce97a4b
Fixes some typo
yethee Mar 20, 2012
2e27d91
Fixed commit ORM transaction
yethee Mar 22, 2012
d88126e
Merge pull request #10 from yethee/refactoring_bugfix
beberlei May 10, 2012
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
61 changes: 0 additions & 61 deletions Controller/ControllerListener.php

This file was deleted.

29 changes: 0 additions & 29 deletions Controller/ControllerResolver.php

This file was deleted.

30 changes: 0 additions & 30 deletions Controller/TraceableControllerResolver.php

This file was deleted.

77 changes: 0 additions & 77 deletions Controller/TransactionalControllerWrapper.php

This file was deleted.

65 changes: 65 additions & 0 deletions DependencyInjection/CompilerPass/DetectConnectionPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
/**
* SimpleThings TransactionalBundle
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/

namespace SimpleThings\TransactionalBundle\DependencyInjection\CompilerPass;

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

/**
* Detects connections and registers the transaction manager services.
*/
class DetectConnectionPass implements CompilerPassInterface
{
public function process(ContainerBuilder $builder)
{
if ($builder->hasParameter('doctrine.connections')) {
foreach ($builder->getParameter('doctrine.connections') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.dbal.'.$alias,
new DefinitionDecorator('simple_things_transactional.provider.dbal')
)->setArguments(array(new Reference($service)));
}
}

if ($builder->hasParameter('doctrine.entity_managers')) {
foreach ($builder->getParameter('doctrine.entity_managers') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.orm.'.$alias,
new DefinitionDecorator('simple_things_transactional.provider.orm')
)->setArguments(array(new Reference('service_container')));
}
}

if ($builder->hasParameter('doctrine_couchdb.document_managers')) {
foreach ($builder->getParameter('doctrine_couchdb.document_managers') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.couchdb.'.$alias,
new DefinitionDecorator('simple_things_transactional.provider.object_manager')
)->setArguments(array(new Reference('service_container')));
}
}

if ($builder->hasParameter('doctrine_mongodb.document_managers')) {
foreach ($builder->getParameter('doctrine_mongodb.document_managers') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.mongodb.'.$alias,
new DefinitionDecorator('simple_things_transactional.provider.object_manager')
)->setArguments(array(new Reference('service_container')));
}
}
}
}

43 changes: 2 additions & 41 deletions DependencyInjection/SimpleThingsTransactionalExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
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;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use SimpleThings\TransactionalBundle\Transactions\TransactionDefinition;

class SimpleThingsTransactionalExtension extends Extension
Expand Down Expand Up @@ -48,11 +47,8 @@ public function load(array $configs, ContainerBuilder $builder)
$config['defaults'] = array_merge(array(
'conn' => array(),
'pattern' => '.*',
'propagation' => TransactionDefinition::PROPAGATION_REQUIRED,
'isolation' => TransactionDefinition::ISOLATION_DEFAULT,
'noRollbackFor' => array(),
'methods' => array('POST', 'PUT', 'DELETE', 'PATCH'),
'subrequest' => false,
), $config['defaults']);

if (isset($config['auto_transactional']) && $config['auto_transactional']) {
Expand All @@ -75,40 +71,5 @@ public function load(array $configs, ContainerBuilder $builder)
$def = $builder->getDefinition('simple_things_transactional.transactional_matcher');
$def->setArguments($args);

if ($builder->hasParameter('doctrine.connections')) {
foreach ($builder->getParameter('doctrine.connections') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.dbal.'.$alias,
new DefinitionDecorator('simple_things_transactional.manager.dbal')
)->setArguments(array(new Reference($service)));
}
}

if ($builder->hasParameter('doctrine.entity_managers')) {
foreach ($builder->getParameter('doctrine.entity_managers') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.orm.'.$alias,
new DefinitionDecorator('simple_things_transactional.manager.orm')
)->setArguments(array(new Reference('doctrine'), $alias));
}
}

if ($builder->hasParameter('doctrine_couchdb.document_managers')) {
foreach ($builder->getParameter('doctrine_couchdb.document_managers') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.couchdb.'.$alias,
new DefinitionDecorator('simple_things_transactional.manager.couchdb')
)->setArguments(array(new Reference($service)));
}
}

if ($builder->hasParameter('doctrine_mongodb.document_managers')) {
foreach ($builder->getParameter('doctrine_mongodb.document_managers') AS $alias => $service) {
$builder->setDefinition(
'simple_things_transactional.tx.mongodb.'.$alias,
new DefinitionDecorator('simple_things_transactional.manager.mongodb')
)->setArguments(array(new Reference($service)));
}
}
}
}
}
47 changes: 47 additions & 0 deletions Doctrine/DBALTransactionProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* SimpleThings TransactionalBundle
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/

namespace SimpleThings\TransactionalBundle\Doctrine;

use SimpleThings\TransactionalBundle\Transactions\TransactionStatus;
use SimpleThings\TransactionalBundle\Transactions\TransactionDefinition;
use SimpleThings\TransactionalBundle\Transactions\TransactionProviderInterface;

/**
* Doctrine DBAL Transaction Provider
*/
class DBALTransactionProvider implements TransactionProviderInterface
{
/**
* @var ContainerInterface
*/
protected $container;

public function __construct($container)
{
$this->container = $container;
}

/**
* Get a transaction status object.
*
* @param TransactionDefinition $def
* @return TransactionStatus
*/
public function createTransaction(TransactionDefinition $def)
{
$conn = $this->container->get('doctrine.' . $def->getConnectionName().'_connection');
return new DBALTransactionStatus($conn, $def);
}
}

Loading