2017 © Pedro Peláez
 

symfony-bundle doctrine-trx-bundle

This bundle provides container managed transactoins in controller actions.

image

pluess/doctrine-trx-bundle

This bundle provides container managed transactoins in controller actions.

  • Saturday, February 16, 2013
  • by pluess
  • Repository
  • 5 Watchers
  • 6 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PluessDoctrineTrxBundle

Adds container managed transactions for doctrine base persistence in controller actions., (*1)

Usage

All you need to do to get an action covered by a transaction, is to add the annotation:, (*2)

<?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

  1. Add this to your composer.json and do a composer update:, (*3)

    "pluess/doctrine-trx-bundle": "dev-master", (*4)

  2. Add this line to your AppKernel.php:, (*5)

    new Pluess\DoctrineTrxBundle\PluessDoctrineTrxBundle(), (*6)

Credits

There are a lot of people I'm learning from. The main learnings for this bundle are coming from, (*7)

Support

Feel free to open issues if you have problems with the bundle., (*8)

The Versions