decorated = $decorated; $this->entityManager = $entityManager; } /** * {@inheritdoc} */ public function handle(Request $request, Response $response): void { try { $this->decorated->handle($request, $response); } finally { // Swoole handle several request in a raw. We clear the entityManager between 2 call, to avoid Doctrine // to re-use the same objects without fetching it from the database. $this->entityManager->clear(); } } }