-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(coroutines): added entity manager resetter, which is decoupled fr…
…om the stability checker, so it can be overridden easily
- Loading branch information
Rastusik
committed
Feb 6, 2023
1 parent
52f9133
commit e8f5c7b
Showing
3 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace K911\Swoole\Bridge\Doctrine\ORM; | ||
|
||
use Doctrine\Persistence\ObjectManager; | ||
use K911\Swoole\Bridge\Symfony\Container\Resetter; | ||
|
||
final class EntityManagerResetter implements Resetter | ||
{ | ||
public function reset(object $service): void | ||
{ | ||
if (!$service instanceof ObjectManager) { | ||
throw new \UnexpectedValueException(\sprintf('Invalid service - expected %s, got %s', ObjectManager::class, \get_class($service))); | ||
} | ||
|
||
$service->clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters