Skip to content

Commit 52c3ff7

Browse files
committed
Signed-off-by: Joey Smith <[email protected]>
1 parent 26f442d commit 52c3ff7

File tree

4 files changed

+50
-20
lines changed

4 files changed

+50
-20
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"require": {
3535
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
36-
"php-db/phpdb": "0.0.x-dev"
36+
"php-db/phpdb": "0.x.2"
3737
},
3838
"require-dev": {
3939
"ext-mysqli": "*",

composer.lock

Lines changed: 16 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ConfigProvider.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
namespace PhpDb\Adapter\Mysql;
66

7+
use PhpDb\Adapter\Mysql\Metadata\Source\MysqlMetadata;
78
use PhpDb\Container\AdapterManager;
9+
use PhpDb\Container\MetadataFactory;
10+
use PhpDb\Metadata\MetadataInterface;
811

912
readonly class ConfigProvider
1013
{
@@ -18,6 +21,12 @@ public function __invoke(): array
1821
public function getDependencies(): array
1922
{
2023
return [
24+
'aliases' => [
25+
MetadataInterface::class => MysqlMetadata::class,
26+
],
27+
'factories' => [
28+
MysqlMetadata::class => MetadataFactory::class,
29+
],
2130
'delegators' => [
2231
AdapterManager::class => [
2332
Container\AdapterManagerDelegator::class,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpDb\Adapter\Mysql\Container;
6+
7+
use PhpDb\Adapter\AdapterInterface;
8+
use PhpDb\Adapter\Mysql\Metadata\Source\MysqlMetadata;
9+
use PhpDb\Adapter\SchemaAwareInterface;
10+
use PhpDb\Metadata\MetadataInterface;
11+
use Psr\Container\ContainerInterface;
12+
13+
final class MysqlMetadataFactory
14+
{
15+
public function __invoke(ContainerInterface $container): MetadataInterface&MysqlMetadata
16+
{
17+
/** @var AdapterInterface&SchemaAwareInterface $adapter */
18+
$adapter = $container->get(AdapterInterface::class);
19+
20+
return new MysqlMetadata(
21+
$adapter
22+
);
23+
}
24+
}

0 commit comments

Comments
 (0)