Skip to content

Commit 6481cb7

Browse files
committed
instant init orm
1 parent ec80a00 commit 6481cb7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/DatabasePackage.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ public function register(Container $container): void
7878
DatabaseAdapter::class,
7979
fn(DatabaseServiceFactory $factory, ?string $tag = null) => $factory->get($tag),
8080
new DIOptions(isolation: true)
81-
);
81+
)
82+
->extend(
83+
function (DatabaseAdapter $db, Container $container, ?string $tag = null) {
84+
// Instant get ORM to init some extends and listeners.
85+
$container->get(ORM::class, tag: $tag);
86+
87+
return $db;
88+
}
89+
);
90+
8291
$container->bindShared(
8392
ORM::class,
8493
fn(Container $container, ?string $tag = null)

0 commit comments

Comments
 (0)