final class DriverSessionFactory
Restricted visibility: declared "@visibility ZtdQuery\Adapter\Pdo". Code outside that scope must not name this declaration.

Answers the session factory a connection's driver needs.

A PDO connection says which driver it speaks; each driver ZTD supports has a platform package that knows how to rewrite that dialect. This is the one place that pairing is written down, so nothing else has to guess it from a driver name.

Methods§

public function driverNames(): list<string>

Answers every driver name ZTD has a platform package for.

Returns

list<string> The driver names, as PDO reports them
Test cases 1
Called from 1
Calls 2
public function forConnection(PDO $pdo): SessionFactory

Answers the factory that builds a session for the connection's driver.

Parameters

$pdoPDOConnection to read the driver name off

Returns

SessionFactory The factory for that driver

Throws

RuntimeException When ZTD has no platform for the driver, or its package is not installed
Test cases 1
Called from 1
Calls 4
public function forDriver(string $driver): SessionFactory

Answers the factory that builds a session for a driver name.

Parameters

$driverstringDriver name, as PDO reports it

Returns

SessionFactory The factory for that driver

Throws

RuntimeException When ZTD has no platform for the driver, or its package is not installed
Test cases 3
Called from 1
Calls 6

Private surface 1§

Implementation details, listed for orientation only.

private const array<string, array{class: class-string<SessionFactory>, package: string}> DRIVER_MAP = ['mysql' => ['class' => \ZtdQuery\Platform\MySql\MySqlSessionFactory::class, 'p…

Test cases 14§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5
Other tests reaching this symbol 9

Relations§

Instantiated in 1
Method calls 1