Skip to content
Open
Show file tree
Hide file tree
Changes from 15 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.

77 changes: 77 additions & 0 deletions DependencyInjection/CompilerPass/DetectConnectionPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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 DetectConnectionsPass 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.manager.dbal')
)->setArguments(array(new Reference($service)));
}
}
*/
$connectionServices = array();

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

if ($builder->hasParameter('doctrine_couchdb.document_managers')) {
foreach ($builder->getParameter('doctrine_couchdb.document_managers') AS $alias => $service) {
$connectionServices[] = 'doctrine_couchdb.odm.' . $alias . '_document_manager';
$builder->setAlias('simple_things_transactional.connections.couchdb.' . $alias
$builder->setDefinition(
'simple_things_transactional.tx.couchdb.'.$alias,
new DefinitionDecorator('simple_things_transactional.manager.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) {
$connectionServices[] = 'doctrine_mongodb.odm.' . $alias . '_document_manager';
$builder->setAlias('simple_things_transactional.connections.mongodb.' . $alias
$builder->setDefinition(
'simple_things_transactional.tx.mongodb.'.$alias,
new DefinitionDecorator('simple_things_transactional.manager.object_manager')
)->setArguments(array(new Reference('service_container')));
}
}
// add tags as well for external resources (Propel, raw-PDO whatever)
$container->setParameter('simple_things_transactional.connection_services', $connectionServices);
}
}
59 changes: 59 additions & 0 deletions DependencyInjection/CompilerPass/TransactionalScopePass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?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\ContainerInterface;

/**
* Scope changes the scope of ALL container scoped services from
* 'container' to 'transactional' if they depend on any transactional
* connection resource.
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class TransactionalScopePass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$connectionServices = $container->getParameter('simple_things_transactional.connection_serices');
$graph = $container->getCompiler()->getServiceReferenceGraph();

$visited = array();
foreach ($connectionServices as $connectionServiceId) {
$this->changeScopeTransactional($connectionServiceId, $visited);
}
}

private function changeScopeTransactional($serviceId, $visited)
{
if (isset($visited[$serviceId])) {
return;
}
$visited[$serviceId] = true;

$node = $graph->getNode($serviceId);
$def = $container->getDefinition($serviceId);

if ($def->getScope() == ContainerInterface::SCOPE_CONTAINER) {
$def->setScope('transactional');
}

foreach ($node->getOutNodes() as $outNode) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be inEdges as you are interested in all services that have a dependency on the connection (in contrast to all dependencies that the connection has onto other services).

$this->changeScopeTransactional($outNode->getId(), $visited);
}
}
}

Loading