Support Doctrine transaction #18

Closed
fruit opened this Issue Dec 16, 2012 · 0 comments

Projects

None yet

1 participant

@fruit
Owner
fruit commented Dec 16, 2012

Transactions inner and outer

When Doctrine objects are deleted/updated inside the Doctrine transaction, object tags are not restored to pre-transaction start point if transaction was aborted or rollback-ed.

$conn = Doctrine_Manager::getInstance()->getCurrentConnection();
try
{
  $conn->beginTransaction();

  ArticleTable::getInstance()
    ->createQuery()
    ->delete()
    ->where('id > 0')
    ->execute();

  // all Article tags should be postponed for removal
  $conn->commit();
  // postponed tags is removed physically here
}
catch (Exception $e)
{
  $conn->rollback();
  // the postponed tags removal should be canceled
}

Transaction savepoints

Why Doctrine does not supports fully transaction savepoints explained on http://wiki.sahanafoundation.org/.
Then, it makes no sense to implement tag updates rollback/commit within savepoints.

@fruit fruit added a commit that referenced this issue Dec 27, 2012
@fruit Adds Doctrine transaction support (first draft implementation) - full…
…y functional, fixed all tests. #18
57f1d12
@fruit fruit added a commit that referenced this issue Dec 30, 2012
@fruit Final changes to handle tags in transactions #18
- Custom exception classes to handle turned off sf_cache and lack of
  context is removed
- Refreshes Doctrine_Query_Cachetaggable::execute to look similar to
  original implementation
- Adds some missing tests
- Update README
b84967a
@fruit fruit closed this Dec 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment