55namespace PhpDb \Adapter \Pgsql ;
66
77use Laminas \ServiceManager \Factory \InvokableFactory ;
8+ use PhpDb \Adapter \Adapter ;
89use PhpDb \Adapter \AdapterInterface ;
910use PhpDb \Adapter \Driver \ConnectionInterface ;
1011use PhpDb \Adapter \Driver \DriverInterface ;
1112use PhpDb \Adapter \Driver \PdoConnectionInterface ;
1213use PhpDb \Adapter \Driver \PdoDriverInterface ;
14+ use PhpDb \Adapter \Driver \Pdo \Statement as PdoStatement ;
1315use PhpDb \Adapter \Platform \PlatformInterface ;
1416use PhpDb \Adapter \Pgsql \Pdo \Connection as PdoConnection ;
1517use PhpDb \Adapter \Pgsql \Pdo \Driver as PdoDriver ;
@@ -25,16 +27,26 @@ public function __invoke(): array
2527 {
2628 return [
2729 'dependencies ' => $ this ->getDependencies (),
28- AdapterInterface::class => $ this ->getAdapters (),
30+ AdapterInterface::class => $ this ->getConfig (),
2931 ];
3032 }
3133
32- public function getAdapters (): array
34+ public function getConfig (): array
3335 {
3436 return [
37+ // Standard Single Adapter configuration
38+ 'driver ' => Driver::class,
39+ 'connection ' => [
40+ 'host ' => 'localhost ' ,
41+ 'port ' => 5432 ,
42+ 'username ' => 'your_username ' ,
43+ 'password ' => 'your_password ' ,
44+ 'database ' => 'your_database ' ,
45+ ],
46+ // Named Adapter configurations
3547 'adapters ' => [
3648 AdapterInterface::class => [
37- 'driver ' => Driver::class,
49+ 'driver ' => Driver::class,
3850 'connection ' => [
3951 'host ' => 'localhost ' ,
4052 'port ' => 5432 ,
@@ -54,6 +66,7 @@ public function getDependencies(): array
5466 Container \AdapterAbstractServiceFactory::class,
5567 ],
5668 'aliases ' => [
69+ AdapterInterface::class => Adapter::class,
5770 DriverInterface::class => Driver::class,
5871 'pgsql ' => Driver::class,
5972 'PgSQL ' => Driver::class,
@@ -69,21 +82,21 @@ public function getDependencies(): array
6982 'PDO_Postgresql ' => PdoDriver::class,
7083 'Pdo_Postgresql ' => PdoDriver::class,
7184 'PDO_PostgreSQL ' => PdoDriver::class,
72- 'pdo_PostgreSQL ' => PdoDriver::class,
7385 ConnectionInterface::class => Connection::class,
7486 MetadataInterface::class => Metadata \Source::class,
7587 PdoConnectionInterface::class => PdoConnection::class,
7688 PlatformInterface::class => AdapterPlatform::class,
7789 ],
7890 'factories ' => [
79- //AdapterInterface::class => Container\AdapterInterfaceFactory::class,
80- AdapterPlatform::class => Container \PlatformInterfaceFactory::class,
81- Connection::class => Container \ConnectionInterfaceFactory::class,
82- Metadata \Source::class => Container \MetadataInterfaceFactory::class,
83- Statement::class => Container \StatementInterfaceFactory::class,
84- Driver::class => Container \DriverInterfaceFactory::class,
85- PdoConnection::class => Container \PdoConnectionInterfaceFactory::class,
86- PdoDriver::class => Container \PdoDriverInterfaceFactory::class,
91+ Adapter::class => Container \AdapterInterfaceFactory::class,
92+ AdapterPlatform::class => Container \PlatformInterfaceFactory::class,
93+ Connection::class => Container \ConnectionInterfaceFactory::class,
94+ Metadata \Source::class => Container \MetadataInterfaceFactory::class,
95+ Statement::class => Container \StatementInterfaceFactory::class,
96+ Driver::class => Container \DriverInterfaceFactory::class,
97+ PdoConnection::class => Container \PdoConnectionInterfaceFactory::class,
98+ PdoDriver::class => Container \PdoDriverInterfaceFactory::class,
99+ PdoStatement::class => Container \PdoStatemenFactory::class,
87100 // Provide the following if you wish to override the Profiler implementation
88101 //ProfilerInterface::class => YourCustomProfilerFactory::class,
89102 // Provide the following if you wish to override the ResultSet implementation
0 commit comments