Skip to content

Commit c965b7e

Browse files
committedFeb 21, 2025·
#46 Use entity manager clear instead of detach
1 parent 2cd1286 commit c965b7e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed
 

‎src/Monolog/Handler/DoctrineProcessHandler.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ public function flush(): void
5959
}
6060
}
6161
$this->em?->flush();
62-
foreach ($this->records as $record) {
63-
$this->em?->detach($record);
64-
}
62+
$this->em?->clear();
6563
$this->records = new ArrayCollection();
6664
}
6765

@@ -70,6 +68,7 @@ protected function write(LogRecord $record): void
7068
$this->records->add($record);
7169
if (500 === $this->records->count()) {
7270
$this->flush();
71+
$this->em?->clear();
7372
}
7473
}
7574
}

0 commit comments

Comments
 (0)
Please sign in to comment.