Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8146971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:11:21+00:00 2026-06-06T14:11:21+00:00

Is it possible to rollback the entire transaction from within the various Doctrine_Record ‘post’

  • 0

Is it possible to rollback the entire transaction from within the various Doctrine_Record ‘post’ hooks? I.E. from within postInsert(), postUpdate(), postSave() etc

I am using Doctrine 1.2 and from the documentation and the API it is not clear how to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:11:24+00:00Added an answer on June 6, 2026 at 2:11 pm

    Looking through the docs it’s clear Doctrine_Event is your best starting point, since that’s passed into the event handlers. Essentially you’ll have to get a hold of the Doctrine_Connection object (through getInvoker()) and then try to call rollback on it.

    Only trouble is getInvoker returns one of several types of objects and I’m unsure if they all support a rollback method, so you may need some conditional logic to determine if you can even rollback from all of them and how to do so for the different cases.

    /**
     * getInvoker
     * returns the handler that invoked this event
     *
     * @return Doctrine_Connection|Doctrine_Connection_Statement|
     *         Doctrine_Connection_UnitOfWork|Doctrine_Transaction   the handler that invoked this event
     */
    public function getInvoker()
    {
        return $this->_invoker;
    }
    

    The documentation shows how to begin, commit and rollback through the a Doctrine_Connection so that should be the easiest starting point. So a listener would look something like:

    class BlogPost extends Doctrine_Record
    {
        public function postUpdate( $event )
        {
            $invoker = $event->getInvoker();
            switch(get_class($invoker)) {
                case 'Doctrine_Connection':
                    $invoker->rollbakck();
                    break;
                case 'Doctrine_Connection_Statement':
                case 'Doctrine_Collection_UnitOfWork':
                case 'Doctrine_Transaction':
                    // todo can we rollback from these ?
                    // if so figure out how :)
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use the SQL BEGIN TRANSACTION, COMMIT TRANSACTION, ROLLBACK TRANSACTION when
Possible Duplicate: SQL Identity (autonumber) is Incremented Even with a Transaction Rollback does a
Would it be possible rollback transactions using Transactionlog file for a particular record? I
in MVC 3 is it possible to rollback the database after calling DbContext.SaveChanges() ?
Is it possible to set a rollback point in any Java IDE (Eclipse, NetBeans,
Is it possible to do git reverts in Egit to rollback changes by creating
In SQL server 2008 R2. Is it possible to do a rollback on a
If I do the following session.getTransaction().rollback(); is it then ok/possible to start calling save/update/delete
Possible Duplicate: Cross-thread operation not valid: Control accessed from a thread other than the
I'm looking for generic code pattern to properly handle transaction with respect to possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.