TransactionManager.php

Same filename in this branch
  1. 10 core/modules/sqlite/src/Driver/Database/sqlite/TransactionManager.php
  2. 10 core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php
Same filename in other branches
  1. 11.x core/modules/sqlite/src/Driver/Database/sqlite/TransactionManager.php
  2. 11.x core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php
  3. 11.x core/modules/pgsql/src/Driver/Database/pgsql/TransactionManager.php

Namespace

Drupal\pgsql\Driver\Database\pgsql

File

core/modules/pgsql/src/Driver/Database/pgsql/TransactionManager.php

View source
<?php

declare (strict_types=1);
namespace Drupal\pgsql\Driver\Database\pgsql;

use Drupal\Core\Database\Transaction\ClientConnectionTransactionState;
use Drupal\Core\Database\Transaction\TransactionManagerBase;

/**
 * PostgreSql implementation of TransactionManagerInterface.
 */
class TransactionManager extends TransactionManagerBase {
    
    /**
     * {@inheritdoc}
     */
    protected function beginClientTransaction() : bool {
        return $this->connection
            ->getClientConnection()
            ->beginTransaction();
    }
    
    /**
     * {@inheritdoc}
     */
    protected function rollbackClientTransaction() : bool {
        $clientRollback = $this->connection
            ->getClientConnection()
            ->rollBack();
        $this->setConnectionTransactionState($clientRollback ? ClientConnectionTransactionState::RolledBack : ClientConnectionTransactionState::RollbackFailed);
        return $clientRollback;
    }
    
    /**
     * {@inheritdoc}
     */
    protected function commitClientTransaction() : bool {
        $clientCommit = $this->connection
            ->getClientConnection()
            ->commit();
        $this->setConnectionTransactionState($clientCommit ? ClientConnectionTransactionState::Committed : ClientConnectionTransactionState::CommitFailed);
        return $clientCommit;
    }

}

Classes

Title Deprecated Summary
TransactionManager PostgreSql implementation of TransactionManagerInterface.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.