src/Connection.php
private function resetTransactionNestingLevel()
    {
        if (! $this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) {
            $reflection = new \ReflectionClass(DBALConnection::class);

            // Private property has been renamed in DBAL 2.9.0+
            if ($reflection->hasProperty('transactionNestingLevel')) {
                $this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel');
            } else {
                $this->selfReflectionNestingLevelProperty = $reflection->getProperty('_transactionNestingLevel');
            }

            $this->selfReflectionNestingLevelProperty->setAccessible(true);
        }

        $this->selfReflectionNestingLevelProperty->setValue($this, 0);
    }
private function resetTransactionNestingLevel()
    {
        if (! $this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) {
            $reflection = new \ReflectionClass(DBALConnection::class);

            // Private property has been renamed in DBAL 2.9.0+
            if ($reflection->hasProperty('transactionNestingLevel')) {
                $this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel');
            } else {
                $this->selfReflectionNestingLevelProperty = $reflection->getProperty('_transactionNestingLevel');
            }

            $this->selfReflectionNestingLevelProperty->setAccessible(true);
        }

        $this->selfReflectionNestingLevelProperty->setValue($this, 0);
    }
private function resetTransactionNestingLevel ( ) { if ( ! $ this -> selfReflectionNestingLevelProperty instanceof \ ReflectionProperty ) { $ reflection = new \ ReflectionClass ( DBALConnection :: class ) ; // Private property has been renamed in DBAL 2.9.0+ if ( $ reflection -> hasProperty ( 'transactionNestingLevel' ) ) { $ this -> selfReflectionNestingLevelProperty = $ reflection -> getProperty ( 'transactionNestingLevel' ) ; } else { $ this -> selfReflectionNestingLevelProperty = $ reflection -> getProperty ( '_transactionNestingLevel' ) ; } $ this -> selfReflectionNestingLevelProperty -> setAccessible ( true ) ; } $ this -> selfReflectionNestingLevelProperty -> setValue ( $ this , 0 ) ; }
This is required because beginTransaction increment transactionNestingLevel
before the real query is executed, and results incremented also on gone away error.
This should be safe for a new established connection.
This is required because beginTransaction increment transactionNestingLevel before the real query is executed and results incremented also on gone away error . This should be safe for a new established connection .