Skip to content

Commit

Permalink
Merge pull request #1071 from oat-sa/feat/REL-1275/container-rebuild-…
Browse files Browse the repository at this point in the history
…and-restart

feat: rebuild and restart DI container in same request
  • Loading branch information
augustas authored Oct 10, 2023
2 parents 8a93fd3 + d7b2a73 commit a33ab5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions common/oatbox/service/ServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ public function getContainer(): ContainerInterface
return $this->getContainerStarter()->getContainer();
}

public function rebuildContainer(): void
{
$this->getContainerStarter()->getContainerBuilder()->forceBuild();
$this->containerStarter = null;
}

/**
* @TODO ContainerBuilder will be removed from here as soon as we do not need ServiceManager anymore.
*/
Expand Down
2 changes: 1 addition & 1 deletion scripts/tools/ContainerCacheWarmup.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function provideDescription(): string

protected function run(): Report
{
$this->getServiceManager()->getContainerBuilder()->forceBuild();
$this->getServiceManager()->rebuildContainer();

return Report::createSuccess('Dependency Injection Container cache warmed up!');
}
Expand Down

0 comments on commit a33ab5d

Please sign in to comment.