File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,11 @@ public function getManagersMap(): array
8383 $ definitions [$ tagValue ['name ' ]] = $ serviceName ;
8484 }
8585
86+ /** @var array{name: string} $tagValue */
87+ foreach ($ builder ->findByTag (OrmExtension::MANAGER_DECORATOR_TAG ) as $ serviceName => $ tagValue ) {
88+ $ definitions [$ tagValue ['name ' ]] = $ serviceName ;
89+ }
90+
8691 return $ definitions ;
8792 }
8893
Original file line number Diff line number Diff line change 44
55use Doctrine \ORM \EntityManager ;
66use Doctrine \Persistence \AbstractManagerRegistry ;
7+ use Doctrine \Persistence \ObjectManagerDecorator ;
78use Doctrine \Persistence \Proxy ;
89use Nette \DI \Container ;
910use Nettrine \ORM \Utils \Binder ;
@@ -45,9 +46,17 @@ protected function resetService(string $name): void
4546 $ manager = $ this ->container ->getService ($ name );
4647
4748 Binder::use ($ manager , function (): void {
48- /** @var EntityManager $this */
49- $ this ->closed = false ; // @phpstan-ignore-line
49+ if ($ this instanceof EntityManager) { // @phpstan-ignore-line
50+ $ this ->closed = false ;
51+ } elseif ($ this instanceof ObjectManagerDecorator) { // @phpstan-ignore-line
52+ Binder::use ($ this ->wrapped , function (): void {
53+ if ($ this instanceof EntityManager) {// @phpstan-ignore-line
54+ $ this ->closed = false ;
55+ }
56+ });
57+ }
5058 });
59+ //throw new \Exception($manager::class);
5160
5261 $ this ->container ->removeService ($ name );
5362 }
You can’t perform that action at this time.
0 commit comments