pluess / doctrine-trx-bundle
This bundle provides container managed transactoins in controller actions.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 6
Forks: 2
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=5.3.3
- doctrine/doctrine-bundle: 1.1.*
- doctrine/orm: >=2.2.3,<2.4-dev
- jms/di-extra-bundle: 1.1.*
- jms/security-extra-bundle: 1.2.*
- kriswallsmith/assetic: 1.1.*@dev
- sensio/distribution-bundle: 2.1.*
- sensio/framework-extra-bundle: 2.1.*
- sensio/generator-bundle: 2.1.*
- symfony/assetic-bundle: 2.1.*
- symfony/monolog-bundle: 2.1.*
- symfony/swiftmailer-bundle: 2.1.*
- symfony/symfony: 2.1.*
- twig/extensions: 1.0.*@dev
This package is not auto-updated.
Last update: 2024-11-09 13:40:00 UTC
README
Adds container managed transactions for doctrine base persistence in controller actions.
#Usage
All you need to do to get an action covered by a transaction, is to add the annotation:
<?php
use Pluess\DoctrineTrxBundle\Annotation\DoctrineTrx as ContainerTransaction;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* @Route("/my_route")
*/
class MyController extends Controller
{
/**
* @Route("/do-something", name = "do_something")
* @ContainerTransaction
*/
public function applyAction(Request $request)
{
$em = $this->getDoctrine()->getManager()
// Do whatever you want to do via doctrine.
// The annotation makes sure it's properly covered by a transaction.
}
}
#Installation
-
Add this to your
composer.json
and do acomposer update
:"pluess/doctrine-trx-bundle": "dev-master"
-
Add this line to your
AppKernel.php
:new Pluess\DoctrineTrxBundle\PluessDoctrineTrxBundle()
#Credits
There are a lot of people I'm learning from. The main learnings for this bundle are coming from
- Matthias Noback: Thanks for the excellent post about annotations and event listeners. This was kind of a door opener for this bundle.
- Johannes Schmitt: Thanks for showing how to write standalone functional test for symfony.
#Support Feel free to open issues if you have problems with the bundle.