Extended to also rollback changes of has-many collections.

{@inheritDoc}
174122
public function rollback()
    {
        parent::rollback();
        foreach ($this->getOriginalAll() as $collection) {
            if ($collection instanceof Collection) {
                $collection->rollback();
            }
        }
        return $this;
    }
365231
def rollback
      begin
        check
        
        @data.each_key do |collection|
          @connection[collection].drop
        end
      rescue CollectionsNotEmptyError => e
        raise RollbackIllegalError, "The collections weren't empty to begin with, rollback aborted."
      end
    end
247318
@Deprecated
    @Override
    @SuppressWarnings("deprecation")
    protected void rollbackRuntime(OperationContext context, ModelNode operation, ModelNode model, List<ServiceController<?>> controllers) {
        revertReload(context);
    }
126774
public boolean replaceWith(Collection collection) {
        boolean changed = false;
        if (items.size() > 0) {
            items.clear();
            changed = true;
        }
        if (items.addAll(0, collection) && !changed) {
            changed = true;
        }
        if (changed) {
            fireContentsChanged(-1, -1);
        }
        return changed;
    }
824797
public function rollback()
    {
        if ($this->signalDispatcher instanceof TransactionHandler) {
            $this->signalDispatcher->rollback();
        }

        return $this->repository->rollback();
    }
197564
public function forget($collection)
    {
        $collection = $this->getCollectionNameFromInstance($collection);

        if ($this->has($collection))
        {
            $this->dirty = true;

            unset($this->entries[$collection]);
        }
    }
382465
public function _cleanup(&$collection)
    {
        $name = $this->name();

        if ($this->isMany()) {
            foreach ($collection as $index => $entity) {
                if (is_object($entity)) {
                    $entity->{$name} = [];
                } else {
                    $collection[$index][$name] = [];
                }
            }
            return;
        }

        foreach ($collection as $index => $entity) {
            if (is_object($entity)) {
                unset($entity->{$name});
            } else {
                unset($entity[$name]);
            }
        }
    }
649471
public function rollBack()
    {
        if (!$this->getIsActive()) {
            // do nothing if transaction is not active: this could be the transaction is committed
            // but the event handler to "commitTransaction" throw an exception
            return;
        }

        $this->_level--;
        if ($this->_level === 0) {
            Log::debug('Roll back transaction' . __METHOD__);
            $this->db->pdo->rollBack();
            $this->db->trigger(Connection::EVENT_ROLLBACK_TRANSACTION);
            return;
        }

        $schema = $this->db->getSchema();
        if ($schema->supportsSavepoint()) {
            Log::debug('Roll back to savepoint ' . $this->_level . __METHOD__);
            $schema->rollBackSavepoint('LEVEL' . $this->_level);
        } else {
            Log::info('Transaction not rolled back: nested transaction not supported' . __METHOD__);
            // throw an exception to fail the outer transaction
            throw new Exception('Roll back failed: nested transaction not supported.');
        }
    }
469966
public void rollbackOdmgAbort(List objects)
    {
        log.info("rollbackOdmgAbort method was called");
        storeObjects(objects);
        getImplementation().currentTransaction().abort();
    }
1175692
public function rollback()
    {
        $migrations = $this->getLast($this->getMigrations(true));

        $this->requireFiles($migrations->toArray());

        $migrated = [];

        foreach ($migrations as $migration) {
            $data = $this->find($migration);

            if ($data->count()) {
                $migrated[] = $migration;

                $this->down($migration);

                $data->delete();
            }
        }

        return $migrated;
    }
210767
public function rollback($pretend = false)
	{
		$this->notes = array();

		// We want to pull in the last batch of migrations that ran on the previous
		// migration operation. We'll then reverse those migrations and run each
		// of them "down" to reverse the last migration "operation" which ran.
		$migrations = $this->repository->getLast();

		if (count($migrations) == 0)
		{
			$this->note('<info>Nothing to rollback.</info>');

			return count($migrations);
		}

		// We need to reverse these migrations so that they are "downed" in reverse
		// to what they run on "up". It lets us backtrack through the migrations
		// and properly reverse the entire database schema operation that ran.
		foreach ($migrations as $migration)
		{
			$this->runDown((object) $migration, $pretend);
		}

		return count($migrations);
	}
1259792
public function rollback()
    {
        if ($this->readOnly) {
            return false;
        }
        $this->readOnly = true;

        fclose($this->fp);
        unlink($this->tmp);
    }
58516
public function rollBack()
    {
        if ($this->transactionNestingLevel === 0) {
            throw ConnectionException::noActiveTransaction();
        }

        $connection = $this->getWrappedConnection();

        $logger = $this->_config->getSQLLogger();

        if ($this->transactionNestingLevel === 1) {
            if ($logger) {
                $logger->startQuery('"ROLLBACK"');
            }
            $this->transactionNestingLevel = 0;
            $connection->rollBack();
            $this->isRollbackOnly = false;
            if ($logger) {
                $logger->stopQuery();
            }

            if ($this->autoCommit === false) {
                $this->beginTransaction();
            }
        } elseif ($this->nestTransactionsWithSavepoints) {
            if ($logger) {
                $logger->startQuery('"ROLLBACK TO SAVEPOINT"');
            }
            $this->rollbackSavepoint($this->_getNestedTransactionSavePointName());
            --$this->transactionNestingLevel;
            if ($logger) {
                $logger->stopQuery();
            }
        } else {
            $this->isRollbackOnly = true;
            --$this->transactionNestingLevel;
        }
    }
1064155
public function rollback()
    {
        $this->attributes->rollback();
        $this->hasOneEmbeds->rollback();
        $this->hasManyEmbeds->rollback();
        $this->doDirtyCheck();
        return $this;
    }
1235606
public void rollbackSetRollbackOnly(List objects)
    {
        log.info("rollbackSetRollbackOnly method was called");
        storeObjects(objects);
        /*
        setRollbackOnly does only rollback the transaction, the client will not be
        notified by an RemoteException (tested on JBoss)
        */
        getSessionContext().setRollbackOnly();
        /*
        seems that some appServer expect that all used resources will be closed before
        the JTA-TXManager does call Synchronization#beforeCompletion(), so we have
        to cleanup used resources. This could be done by call abort on odmg-api
        */
        getImplementation().currentTransaction().abort();
    }
943087
def rollback(self, transaction = None):
        """"""
        if not self.in_transaction:
            raise NotInTransaction
        for collection, store in self.stores.items():
            store.rollback()
            indexes = self.indexes[collection]
            indexes_to_rebuild = []
            for key, index in indexes.items():
                try:
                    index.rollback()
                except NotInTransaction:
                    # this index is "dirty" and needs to be rebuilt
                    # (probably it has been created within a transaction)
                    indexes_to_rebuild.append(key)
            if indexes_to_rebuild:
                self.rebuild_indexes(collection, indexes_to_rebuild)
        self.in_transaction = False
1205399
protected function _rollBack()
    {
        $this->_connect();
        $this->_connection->rollback();
        $this->_connection->autocommit(true);
    }