pluess/doctrine-trx-bundle
Composer 安装命令:
composer require pluess/doctrine-trx-bundle
包简介
This bundle provides container managed transactoins in controller actions.
关键字:
README 文档
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.jsonand 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.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-02-16