From 01842f99b65b06d2647470c3b867719e72dabde7 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Mon, 5 Oct 2020 21:44:27 +0200 Subject: Introduce some new database wrappers This will allow us to avoid using globals and use the autoloader in the future. --- ratatoeskr/sys/Env.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ratatoeskr/sys/Env.php') diff --git a/ratatoeskr/sys/Env.php b/ratatoeskr/sys/Env.php index cfe1598..63d079d 100644 --- a/ratatoeskr/sys/Env.php +++ b/ratatoeskr/sys/Env.php @@ -34,4 +34,13 @@ class Env { return $this->lazy("textprocessors", [TextprocessorRepository::class, 'buildDefault']); } + + public function database(): Database + { + return $this->lazy("database", static function () { + global $config; + + return Database::fromConfig($config); + }); + } } -- cgit v1.2.3-70-g09d2