Skip to content

Add accessor for wrapped DBAL Connection to TracingDriverConnection #536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Make the transport factory configurable in the bundle's config (#504)
- Add the `sentry_trace_meta()` Twig function to print the `sentry-trace` HTML meta tag (#510)
- Make the list of commands for which distributed tracing is active configurable (#515)
- Introduce `TracingDriverConnection::getWrappedConnection()` (#536)

## 4.1.4 (2021-06-18)

Expand Down
5 changes: 5 additions & 0 deletions src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ public function errorInfo()
throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__));
}

public function getWrappedConnection(): DriverConnectionInterface
{
return $this->decoratedConnection;
}

/**
* @phpstan-template T
*
Expand Down
7 changes: 7 additions & 0 deletions tests/Tracing/Doctrine/DBAL/TracingDriverConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ public function testRollBackDoesNothingIfNoSpanIsSetOnHub(): void
$this->assertFalse($this->connection->rollBack());
}

public function testGetWrappedConnection(): void
{
$connection = new TracingDriverConnection($this->hub, $this->decoratedConnection, 'foo_platform', []);

$this->assertSame($this->decoratedConnection, $connection->getWrappedConnection());
}

/**
* @return \Generator<mixed>
*/
Expand Down