2017 © Pedro Peláez
 

library trf4php-doctrine

This is a Doctrine binding for trf4php.

image

trf4php/trf4php-doctrine

This is a Doctrine binding for trf4php.

  • Monday, March 19, 2018
  • by szjani
  • Repository
  • 1 Watchers
  • 5 Stars
  • 21,274 Installations
  • PHP
  • 4 Dependents
  • 3 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 2 % Grown

The README.md

trf4php-doctrine

Latest Stable Version, (*1)

master: Build Status Coverage Status 1.2: Build Status Coverage Status, (*2)

This is a Doctrine binding for trf4php, (*3)

Using trf4php-doctrine

Configuration

<?php
/* @var $em \Doctrine\ORM\EntityManager */
$tm = new DoctrineTransactionManager($em);

Using transactions

<?php
/* @var $tm TransactionManager */
try {
    $tm->beginTransaction();
    // database modifications
    $tm->commit();
} catch (TransactionException $e) {
    $tm->rollback();
}

Transactional EntityManager

If a transaction fails, you have to close your EntityManager. Doctrine says that after closing an EM, you have to create another one if you want to use database. TransactionalEntityManagerReloader does it automatically., (*4)

To enable this feature, you have to do the following steps:, (*5)

  • Use EntityManagerProxy in DoctrineTransactionManager
  • Attach TransactionalEntityManagerReloader observer to DoctrineTransactionManager
$tm = new DoctrineTransactionManager(new DefaultEntityManagerProxy());
$emFactory = new DefaultEntityManagerFactory($conn, $config);
$tm->attach(new TransactionalEntityManagerReloader($emFactory));

If you would like to use a shared, non-transactional EntityManager, pass it to the constructor of DefaultEntityManagerProxy. In this case you can use the proxy object without starting a transaction, which is not recommended, but sometimes necessary., (*6)

This feature is also useful in integration tests. You can rollback in tearDown() thus you don't need to reinitialize the database. It highly speed-up your tests., (*7)

History

1.2

Transactional EntityManager

Create an EntityManager right after you start a transaction., (*8)

The Versions

19/03 2018

2.0.x-dev

2.0.9999999.9999999-dev

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper doctrine facade transaction

19/03 2018

2.0.0

2.0.0.0

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper doctrine facade transaction

04/12 2013

1.2.x-dev

1.2.9999999.9999999-dev

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper doctrine facade transaction

04/12 2013

dev-master

9999999-dev

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper doctrine facade transaction

01/11 2013

1.2.1

1.2.1.0

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper doctrine facade transaction

28/10 2013

1.2.0

1.2.0.0

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

wrapper doctrine facade transaction

17/05 2013

1.1.x-dev

1.1.9999999.9999999-dev

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

wrapper doctrine facade transaction

17/05 2013

1.1.1

1.1.1.0

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

wrapper doctrine facade transaction

27/12 2012

1.1.0

1.1.0.0

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

wrapper doctrine facade transaction

17/12 2012

1.0.x-dev

1.0.9999999.9999999-dev

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

wrapper doctrine facade transaction

17/12 2012

1.0.1

1.0.1.0

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

wrapper doctrine facade transaction

15/12 2012

1.0.0

1.0.0.0

This is a Doctrine binding for trf4php.

  Sources   Download

MIT

The Requires

 

wrapper doctrine facade transaction