Removed auto-flushing for every event from EventManager.
This commit is contained in:
@@ -111,7 +111,8 @@ class EventManager
|
||||
'class' => $class,
|
||||
'library' => $library
|
||||
]);
|
||||
$e->save($this->g->getEntityManager());
|
||||
|
||||
$this->g->getEntityManager()->persist($e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,8 @@ class ModuleManager
|
||||
|
||||
try {
|
||||
$class::onRegister($this->g, $m);
|
||||
$m->save($this->g->getEntityManager());
|
||||
$this->g->getEntityManager()->persist($m);
|
||||
$this->g->getEntityManager()->flush();
|
||||
} catch (Throwable $e) {
|
||||
$this->g->getLogger()->error("Calling {$class}::onRegister failed with exception: {$e->getMessage()}");
|
||||
unset($m);
|
||||
|
||||
@@ -96,6 +96,7 @@ class EventManagerTest extends CoreModelTestCase
|
||||
$library = 'lotgd/tests';
|
||||
|
||||
$em->subscribe($pattern, $class, $library);
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$sub = EventSubscription::create([
|
||||
'pattern' => $pattern,
|
||||
|
||||
@@ -159,6 +159,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
$this->g->getEventManager()->subscribe('/h\/lotgd\/core\/default-scene/', DefaultSceneProvider::class, 'lotgd/core/tests');
|
||||
$this->g->getEventManager()->subscribe('/h\/lotgd\/core\/navigate-to\/.*/', DefaultSceneProvider::class, 'lotgd/core/tests');
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$v = $this->g->getViewpoint();
|
||||
// Run it twice to make sure no additional DB operations happen.
|
||||
@@ -214,6 +215,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
// subscribe event
|
||||
$this->g->getEventManager()->subscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$action = new Action(7, null, ["foo" => "baz"]);
|
||||
$actionId = $action->getId();
|
||||
@@ -243,6 +245,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
// subscribe event
|
||||
$this->g->getEventManager()->subscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$action = new Action(7, null, ["foo" => "baz"]);
|
||||
$actionId = $action->getId();
|
||||
|
||||
Reference in New Issue
Block a user